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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started