subject

Write a program to display all the prime numbers from 2 to 'X' ('X' being entered by the user). Ask the user for an integer greater than 2 (and continue to ask the user for an integer greater than 2 until the user enters a valid number). Then, using a for loop, display all the primer numbers from 2 up to the number entered by the user. Invoke a function from within the for loop, passing it the number between 2 and 'X', have the function return True if the number is prime and False otherwise, and use the return value to determine if the number should be displayed. Name the function IsPrime().

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:30
Consider the following statements: #include #include class temporary { private: string description; double first; double second; public: temporary(string = "", double = 0.0, double = 0.0); void set(string, double, double); double manipulate(); void get(string& , double& , double& ); void setdescription(string); void setfirst(double); void setsecond(double); }; write the definition of the member function set() so that the instance variables are set according to the parameters. write the definition of the constructor so that it initializes the instance variables using the function set() write the definition of the member function manipulate() that returns a decimal number (double) as follows: if the value of description is "rectangle", it returns first * second if the value of description is "circle" it returns the area of a circle with radius first if the value of description is "cylinder" it returns the volume of a cylinder with radius first and height second. hint: the volume of a cylinder is simply the area of the circle at the base times the height. if the value of description is "sphere" it returns the volume of the sphere with radius first. otherwise it returns -1.0;
Answers: 1
question
Computers and Technology, 22.06.2019 02:00
What is the process in which the software development team compiles information to determine the final product.
Answers: 3
question
Computers and Technology, 22.06.2019 17:30
The forerunner to cell phones, pdas, and smartphones was
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Q14 what is most important for you to choose before you build a network? a. private network b. nos c. network media d. network protocol e. directory service
Answers: 1
You know the right answer?
Write a program to display all the prime numbers from 2 to 'X' ('X' being entered by the user). Ask...
Questions
question
Social Studies, 13.10.2020 17:01
question
Social Studies, 13.10.2020 17:01
question
Mathematics, 13.10.2020 17:01
Questions on the website: 13722367