Question: Please write this program in C++ 2. Prime numbers Write a program that implements the method isPrime. The method takes one integer as its argument
Please write this program in C++

2. Prime numbers Write a program that implements the method isPrime. The method takes one integer as its argument and returns true if the input integer is a prime, otherwise false. A prime number is a whole number that is greater than 1 and can only be divided evenly by 1 and by itself Demonstrate the function by calling it in a loop that displays a table of integers 1 through 20 and indicate it is a prime number or not. Prototype for the isPrime function bool isPrime (int num); Sample output: % hw02_p2 1 not prime 2 PRIME 3 PRIME 4 not prime 5 PRIME 6 not prime 7 PRIME
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
