Question: Write a function named isPrime, which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise.
Write a function named isPrime, which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. The program should ask for the number in main, and pass that number to the isPrime function, returning the result as to whether this number was prime or not prime. It should then display that as console output, and ask for another number from the user (repeating until the user no longer wants to make a request). For a bonus point, for each number the user enters, return all the prime numbers from 2 up until that number (hint, you will need an additional loop). Validate all input. Do not use using namespace std;. Dont forget your pre and post conditions. I need help with this , note that i need it in c++ , also without using namespace std. Thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
