Ask the user for a number between 3 and 100 (inclusive). Determine

profileadelen
 (Not rated)
 (Not rated)
Chat

Ask the user for a number between 3 and 100 (inclusive). Determine if the number is prime; that is, check to see if it is evenly divisible by any number other than itself. You must write a function called isPrime and call it as follows:

int answer;
answer = isPrime(num);
cout << num;
if (answer == 1) {
cout << " is prime";
cout << endl;
}
else {
cout << " is NOT prime";
cout << endl;
}
    • 11 years ago
    the answer
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      the-pro.zip