Practical 4

You should first complete any remaining work from last week.

Exercise 1

The Prime Numbers are the numbers greater than 1 with no integer divisor other than one and the number itself.
For example, 7 is a prime number because,
7%2 = 1
7%3 = 1
7%4 = 3
7%5 = 2
7%6 = 1
but 9 is not prime because 9%3 = 0.
-7, 0 and 1 are not prime numbers because they are not more than one.
The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 and 37.
Enter a number to test: 7
7 is prime
Enter a number to test: 9
9 is not prime (divides by 3)

Exercise 2

Exercise 3

You may follow the format of the program in the practicals or use your own design. You can extend the program as you wish (try adding student names).