Question: Q 5 . Write a program Prime.cpp that prompts for user input of a positive integer and displays whether the input number is a prime

Q5. Write a program Prime.cpp that prompts for user input of a positive integer and displays whether the input
number is a prime number of not. A number is a prime number if it is divisible by 1 and itself only. Note that
1 is not a prime number.
Sample result 1:
Input a positive integer: 13
13 is a prime number
Sample result 2:
Input a positive integer: 123
123 is not a prime number
Hint: All numbers, no matter prime or not, are divisible by 1 and itself. Except 1 and itself, a prime number
does not has other factor.
Q 5 . Write a program Prime.cpp that prompts for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!