Question: Question 1, relates to question 2....Using C++ Question 2 Write a program that determines if a number is prime. A Prime Number can only be
Question 1, relates to question 2....Using C++

Question 2

Write a program that determines if a number is prime. A Prime Number can only be evenly divided by 1 and itself. Thus, given a number n, if there are any factors of n between 1 and n, n is not a prime number. a) Main should handle al1 input and output b) Create an isPrime function: returns true if a number is prime - returns false if a number is not prime Example Output 1 Enter a number 15 Is . 2 a factor of 152 No Is 3 a factor of 15? Yes 15 is not a prime number Enter a number: 7 Is 2 a factor of 7? No. Is 3 a factor of 7? No. Is 4 a factor of 7? No. Is 5 a factor of 7? No. Is 6 a factor of 72 No 7 is a prime number
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
