Question: C++ Exercise 1: Prime numbers Write a program to ask the user for integer n and then prints out if n is prime number it

 C++ Exercise 1: Prime numbers Write a program to ask the C++

Exercise 1: Prime numbers Write a program to ask the user for integer n and then prints out if n is prime number it is not prime number. Use a return-value function, to be called prime (..) to test whether a given number is prime or not. The prototype statement for this function is: bool prime (int) ; Note: A number n is prime if it only divides evenly by 1 and n itself. Sample input/output: binck 1 io nter nunber to check if it is prone or not: 2 is a prine nunber Process returned 0 (8x0) execution tine : 5.120 s Press any key to continue. ter a nunber to check if it is a prone or not: 22 2 is NOT a prine rocess returned 8 (8x8) execution tine 5.384 s ress any key to cont inue

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 Databases Questions!