Description
The purpose of this challenge is to use IF, nested IFs and the DO-WHILE statements while using basic comparison operators.
Requirements
- Use a do-while loop to continuously process the following, until the user enters a zero value (Stop asking and exit the program once the user enters a zero)
- Display a message that asks the user to enter a number (negative numbers are OK)
- If the number entered is 411, display the message “You can’t handle the information!”
- If the number entered is 404, display the message “Page Not Found”
- Note that your IF statements must handle each requirement in #3 and #4 above separately. If the entered number is neither 404 nor 411, then do the following:
- If the number is negative, display “Negative!”
- If the number is divisible by 2, display “Even!” Otherwise, display “Odd!”
- If the number is divisible by 5, display “Divisible by 5”
- Note that certain numbers entered will cause all i, ii, and iii to show messages
- When the user enters a number, display a goodbye message.
Sample Interaction / Output
Enter a number: -5 Negative! Divisible by 5 Enter a number: 411 You can't handle the information Enter a number: 404 Page Not Found Enter a number: 8 Even! Enter a number: 11 Odd! Enter a number: 10 Even! Divisible by 5 Enter a number: -25 Negative! Even! Divisible by 5 Enter a number: 0 See ya!
LEGEND
PROGRAM OUTPUT
USER ENTRY
FROM INPUT
CATALOG ID: CPP-LOOP0003
Print Requirements