Prime numbers are numbers that are: Greater than 1, and has no divisors other than 1 and
Question:
Prime numbers are numbers that are: Greater than 1, and has no divisors other than 1 and itself.
This means that numbers such as 7 and 11 are prime because they cannot be cleanly divided. However, numbers such as 8 and 15 are NOT prime because they can be divided by 2 and 3, respectively.
Prime numbers are used frequently with cryptography, so it can be important to identify them.
Create a script that prompts the user for a number. In the script, create a function is_prime that takes the number as a parameter. The function then returns true or false if the number is prime, and the script reports the result.
Sample input: 5 Sample output: 5 is prime |
Sample input: 12 Sample output: 12 is NOT prime |
Sample input: 104743 Sample output: 104743 is prime |
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts