if else statement in c example
Example: c if else
if (<condition>) {
<code>
} else if (<condition>) {
<code>
} else {
<code>
}
/* example */
int money = 50;
if (money < 15) {
go_home();
} else if (money >= 600) {
buy_all();
} else {
buy_tickets(money / 15);
}
/* You can chain together as many else ifs as you want. But if there are
too many it will make the code hard to understand. In that case I would
recommend trying other solutions. */