Code that finds and outputs the first x number of prime


In C++ language:

Code that finds and outputs the first x number of prime numbers, beginning with 2, where x is chosen by the user. Remember that a prime number is a number that is only divisible by itself and 1 -- it has no other factors. Note that if the user enters an invalid amount, you must tell them the amount entered is invalid. After a successful or unsuccessful search for prime numbers, prompt the user if they would like to try again.

ex:

Computer: How many prime numbers do you want to see?

User: 0

Computer: I can't search for 0 prime numbers.

Computer: Would you like to try again?

User: Yes

How many prime numbers do you want to see?

User: 5

Computer: The first 5 prime numbers are: 2 3 5 7 11

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Code that finds and outputs the first x number of prime
Reference No:- TGS02522243

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)