005-003-009
Basic Nested If Statements
Easy
Problem Description
Basic Nested If Statements
In this problem, you will create a program that uses nested if statements to perform two-level condition checking on age (age) and license status (hasLicense), and displays the result to standard output.
Learning Objective: Understand nested structure with if statements inside if statements
Overview
Use nested if statements to perform two-level condition checking.
Specifications
- Initialize variable
agewith 25 andhasLicensewith true - Check if age is 18 or above, then check if hasLicense is true
- Output "Can drive" if both conditions are met
- Output "Need license" if age is met but no license
- Output "Too young" if age condition is not met
Output Format
Can drive
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