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

 Exercise 1: Prime numbers Write a program to ask the user

Exercise 1: Prime numbers Write a program to ask the user for integer n and then prints out if n is prime number. Use a return-value function, to be called prime (..).to test whether a given number is prime or not. The prototype st for this function is: atement bool prime(int) i Create another function called divisibleByTwo(..) check if the number is divisible by 2 or not (in case the number entered by the user is not prime). Note: A number n is prime if it only div Sample input / output: Enter a number to check if it is a prime or not: 11 ides evenly by 1 and n itself. 11 is a prime number Enter a number to check if it is a prime or not: 22 22 is NOT a prime 22 is dividable by2 Enter a number to check if it is a prime or not: 33 33 is NOT a prime 33 It's not dividable by 2

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!