subject

Write a program that prompts the user to enter in a positive number. Only accept positive numbers - if the user supplies a negative number or zero you should re-prompt them. Next, determine if the given number is a prime number. A prime number is a number that has no positive divisors other than 1 and itself. For example, 5 is prime because the only numbers that evenly divide into 5 are 1 and 5. 6, however, is not prime because 1, 2, 3 and 6 are all divisors of 6.
Here's a sample running of the program:
Enter a positive number to test: 5
2 is NOT a divisor of 5...
3 is NOT a divisor of 5...
4 is NOT a divisor of 5...
5 is a prime number!
And here's another running:
Enter a positive number to test: 9
2 is NOT a divisor of 9...
3 is a divisor of 9...
9 is NOT a prime number.
Some notes on your program:
1 is technically not a prime number.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:30, caldonjoshhsms2061
What are the steps involved in accepting all the changes in a document? arrange these in order click edit. click accept or reject. click changes. click accept all.
Answers: 1
image
Computers and Technology, 22.06.2019 18:10, AdoNice
How can i delete permalinks from a word press site?
Answers: 1
image
Computers and Technology, 24.06.2019 00:20, danielmartinez024m
The guy wire bd exerts on the telephone pole ac a force p directed along bd. knowing the p must have a 720-n component perpendicular to the pole ac, determine the magnitude of force p and its component along line ac.
Answers: 2
image
Computers and Technology, 24.06.2019 08:10, anthonysutton82
Where are american poets found in the dewey decimal system
Answers: 1
You know the right answer?
Write a program that prompts the user to enter in a positive number. Only accept positive numbers -...

Questions in other subjects: