DWITE Online Computer Programming Contest
In mathematics, a prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example: 2, 3, 5, 7, 11, 13, 17, 19 are the first eight prime numbers. A vanilla flavour programming problem is to figure out if a given number is a prime or not.
A single integer N (-1000 ≤ N ≤ 1000)
A single line containing either the word "prime" or the word "not", depending on whether N is prime or not.
Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 19, 2010
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
For example, if the number was 16, and I run it through your loop, it would output "prime' because 16 is not divisible by 7. Please run through your own test cases before posting a question.