Loops 3

Description

The purpose of this challenge is to use IF, nested IFs and the DO-WHILE statements while using basic comparison operators.

Requirements

  1. 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)
  2. Display a message that asks the user to enter a number (negative numbers are OK)
  3. If the number entered is 411, display the message “You can’t handle the information!”
  4. If the number entered is 404, display the message “Page Not Found”
  5. 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:
    1. If the number is negative, display “Negative!”
    2. If the number is divisible by 2, display “Even!” Otherwise, display “Odd!”
    3. If the number is divisible by 5, display “Divisible by 5”
    4. Note that certain numbers entered will cause all i, ii, and iii to show messages
  6. 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