005-001-009
If Statement: Age Verification System
Medium
Problem Description
if statement: Age Verification System
In this problem, you will create a program that reads an age as an integer, uses an if statement to determine whether the person is 18 or older, and displays "Adult" or "Minor" to standard output.
Learning Objective: Execute conditional processing using if statements
Create a program to input age and determine if the person is an adult. Use if statements for conditional branching.
Input
Line 1: Age (integer)
Output
- If 18 or older: "Adult"
- If under 18: "Minor"
Examples
Example 1
Input:
20
Output:
Adult
Example 2
Input:
15
Output:
Minor
Example 3
Input:
18
Output:
Adult
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