Project 89: Is the Number Prime

A prime number is a number that is divisible by only 1 and itself.  For example, 77 is not prime (because 7x11) but 71 is prime since the only integers that divide 71 evenly are 1 and 71.


Modulus:  The % symbol computes remainder of a number when divided by another number.

7%2 = 1 because when 7 is divided by 2, 1 is left over.

13%5= 3 because when 13 is divided by 5, 3 is left over.

45%15= 0 because 15 divides 45 evenly.


Project 89: Variable 'n' has been initialized.  

n represents a positive number larger than 2.

Task: Appropriately assign the value for the variable 'isPrime' that represents whether 'n' is prime or not.  The value 'true' should be assigned to 'isPrime' if the number is prime, and 'false' should be assigned to 'isPrime' if the number is not prime.

Note:  Since there are only two possible answers (prime or not prime) try at least 10 examples to make sure the code works for multiple numbers.

**If your code works for 10 test cases, you can enter your e-mail address

Universal Computational Math Methods:

pow(5,2) returns 25.0

abs(-3.0) returns 3

sqrt(49.0) returns 7.0