Question: Write a c++ program to check whether the user input is prime. Any method is accepted except the following for loop: please don't use the
Write a c++ program to check whether the user input is prime.
Any method is accepted except the following for loop: please don't use the code below in your program, similar ideas are allowed.
for(int i = 2; i <= num/2; ++i) { // condition for nonprime number if(num % i == 0) { flag = true; break; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
