Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++/ codeBlocks is the format w are using for our current semester. Thanks:) 3460:209 Assignment 5-A Assignment 5-A: Prime Number Overview The purpose of this
C++/ codeBlocks is the format w are using for our current semester. Thanks:)
3460:209 Assignment 5-A Assignment 5-A: Prime Number Overview The purpose of this assignment is to make sure that you know how to write a program that contains functions that meet specific requirements. WARNING: Your work will receive no points if you solve the problem without implementing the required C++ function. Moreover, your function must work correctly for passing the argument. PROGRAM SPECIFICATION For the assignment, we will write a program and an isPrime Function. A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6 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 additiona loop) Validate all input. Do not use using namespace std;. Don't forget your pre and post conditions Hints: Recall that the % operator divides one number by another, and returns the remainder of the division. In an expression such as num1 % num2 , the % operator will return 0 if num1 is evenly divisible by num2Step 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