Kodewick
Start learning →
Basic←→0 / 70

Zoo ticket

#013BasicConditions4 min

Zoo tickets: under 3 is free, 3 to 11 is 20, and 12 and over is 40. Write zoo_ticket(age) to return the price. price starts at 40; change it depending on the age.

Examples
zoo_ticket(30)→40
zoo_ticket(8)→20
zoo_ticket(2)→0
The functionint zoo_ticket(int age)
main.c
int zoo_ticket(int age) {
    int price = 40;
    // your code here: under 3, set price to 0; under 12, set it to 20
    return price;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.