-
Notifications
You must be signed in to change notification settings - Fork 0
Practice Problem 9
Seanti edited this page Mar 26, 2025
·
1 revision
Ask the user to enter their age. If they enter non-numeric input, handle the error using try-catch and ask them to enter a valid number.
✅ Valid input:
Enter your age: 20
You are 20 years old.
❌ Invalid input (letters entered):
Enter your age: hello
Invalid input! Please enter a valid number.
Enter your age: 18
You are 18 years old.