005-004-003
Logical Operators: Discount Eligibility
Easy
Problem Description
Logical Operators: Discount Eligibility
In this problem, you will create a program that reads an age as input, evaluates a compound condition (65 or older OR 12 or younger) using the || (logical OR) operator, and displays whether a discount applies to standard output.
Learning Objective: Combine multiple conditions with logical OR operator
Create a program that inputs an age and determines discount eligibility. Use the || (OR) operator to apply a discount when the age is 65 or older OR 12 or under.
Input
Line 1: Age (integer)
Output
When eligible:
Age: [age] years old
Discount applied
When not eligible:
Age: [age] years old
Regular price
Examples
Example 1: Senior (65+)
Input:
70
Output:
Age: 70 years old
Discount applied
Example 2: Child (12 or under)
Input:
10
Output:
Age: 10 years old
Discount applied
Example 3: General (13-64)
Input:
30
Output:
Age: 30 years old
Regular price
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up