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 1, relates to question 2....Using C++ Question 2 Write a program

Question 2

that determines if a number is prime. A Prime Number can only

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

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!