Title: Assignment 6
Course: COP 1510 Programming Concepts > Section: Module 7 - Functions

For your module 7 assignment, you will design and write a program following the specification that is given below. Design your program using a flowchart and pseudocode. Submit your final flowchart and pseudocode design in the dropbox.

Prime Number

A prime number is a number that is only evenly divisible by 1 and itself. For example, 11 is a prime number because it can only be evenly divided by 1 and 11. However, 9 is not a prime number because it is divisible by 1, 9, and 3. Design a function named is Prime that returns a Boolean value. It should receive one integer argument and the function will return true if the argument is a prime number. It will return false if the argument is not a prime number. Demonstrate this new function in a program that asks the user to enter a number and then displays a message indicating if the number is prime or not prime.

HINT: Recall you can use the MOD operator to check for remainder from division. For a number to be prime, the MOD operator must be non-zero for every value from 2 through number – 1. For example, if the input is 10, 10 MOD 2 returns 0, so that means this is not a prime number. For an input value of 5, 5 MOD 2 returns 1, 5 MOD 3 returns 2, and 5 MOD 4 returns 1, so this is a prime number.

Example Output:

Please enter a number:
13 [Enter]
13 is a prime number
Please enter a number:
45 [Enter]
45 is not a prime number