โจทย์
A cinema charges by age: children under 3 are free, ages 3–12 pay 5, ages 13–64 pay 12, and 65 or older pay 7.
Implement ticket_price(age).
Input
age: The visitor's age in years.
Output
Return the ticket price.
เงื่อนไข
0 ≤ age ≤ 120
ตัวอย่าง
ตัวอย่างที่ 1
อินพุต:
age = 10
ผลลัพธ์ที่คาดหวัง:
expected = 5
อินพุต:
long long age = 10;
ผลลัพธ์ที่คาดหวัง:
long long expected = 5;
อินพุต:
long age = 10;
ผลลัพธ์ที่คาดหวัง:
long expected = 5;
คำอธิบาย
10 is between 3 and 12, so the price is 5.
ตัวอย่างที่ 2
อินพุต:
age = 70
ผลลัพธ์ที่คาดหวัง:
expected = 7
อินพุต:
long long age = 70;
ผลลัพธ์ที่คาดหวัง:
long long expected = 7;
อินพุต:
long age = 70;
ผลลัพธ์ที่คาดหวัง:
long expected = 7;
คำอธิบาย
70 is 65 or older, so the senior price of 7 applies.
แหล่งอ้างอิง
โจทย์นี้ปรับให้เหมาะกับ CodeUtility กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน