Prime Number ASAP Please

3) Write a C++ program to ask the user to enter a number N from the keyboard and then check whether the entered number is prime or not (use while loop). Your program must have the following requirements:

a. Make sure that the number entered by the user is greater than 1. If the number entered by the user is less than or equal to 1 then display appropriate error message and prompt the user to enter the number again.
b. Most lines should have a comment.
c. The results must be displayed on the computer screen exactly as shown below:

Program to check for prime number
-------------------------------------------
Please enter a number greater than 1: 1 -------------User Input
Entered number is less than or equal to 1
Please try again...

Please enter a number greater than 1: 19-------------User Input
The number 19 is a prime number

Press any key to continue . . .



Looking for your help ASAP.

Thanks
That's quite easy. I would help, but you don't seem to have any code.
That's quite easy. I would help, but you don't seem to have any code.

Ditto. Although, i'm feeling nice so i'll tell you that you will need for loops and a particular operator... enjoy!
Last edited on
Topic archived. No new replies allowed.