A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime...


A prime number is a number that is only evenly divisible by itself and 1.  For example, the number 5 is prime because it can only be evenly divided by 1 and 5.  The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6.


Design a Boolean function called isPrime, that accepts an integer as an argument and returns True if the argument is a prime number, or False otherwise.  Use the function in a program that prompts the user to enter a number and then displays a message indicating whether the number is prime.  The following modules should be written:



getNumber, that accepts a Ref to an integer, prompts the user to enter a number, and accepts that input



isPrime, that accepts an integer as an argument and returns True if the argument is a prime number, or False otherwise



showPrime, that accepts an integer as an argument , calls isPrime, and displays a message indicating whether the number is prime


The main module, that will call getNumber and showPrime



Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here