Question: 1. Program is_prime. cpp: Study the starter code in is prime. cpp, which uses a while loop to determine if an input integer n is
1. Program is_prime. cpp: Study the starter code in is prime. cpp, which uses a while loop to determine if an input integer n is a prime number. A prime number is an integer that is only divisible by 1 and itself. The provided solution loops through each number between 2 and n -1. If any number in the range divides into integer n then n is not prime, otherwise integer n is prime a. Compile and run the starter code on different input values. Assume that the user will only enter an integer greater than 2 b. Re-write the while loop using a for loop instead so the program behaves exactly as the starter code. c
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
