Question: ***C++*** Descriptiorn Write a function that takes a positive integer and displays all the prime numbers of smaller than or equal to the given integer.
Descriptiorn Write a function that takes a positive integer and displays all the prime numbers of smaller than or equal to the given integer. Add this function as another option to your main program. Display purpose of the program. Get number -takes no argument and returns an integer inputted by the user. Integer must be larger than 1 but smaller than 10000. Is prime- takes an integer as its argument and returns a Boolean variable, which indicates if the given integer is prime or not. To determine if the integer (number) is prime write a loop that checks if given number is divisible (use % operation) by any integer from 2 to number 1 If given number is not divisible by any of those integers then it is prime, otherwise it is not Use is prime function to check all the numbers fro 2 to inputted number and display those that are prime
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
