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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!