DWITE Online Computer Programming Contest
October 2007
Problem 1
Vanilla Primes
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.
Input
A single integer N (-1000 ≤ N ≤ 1000)
Output
A single line containing either the word "prime" or the word "not", depending on whether N is prime or not.
Sample Input-1 |
Sample Outputnot |
Sample Input1 |
Sample Outputnot |
Sample Input2 |
Sample Outputprime |
All Submissions
Best Solutions
Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 19, 2010
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
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.