Our next contest is:
Tuesday, March 31, 2009
Prime Numbers and Emirps
Prime numbers are numbers that have no other factors
besides one and the number itself. Some
examples of prime numbers are: 2, 3, 5,
7, 11, 13, 17, 19, 23, 29, 31 & 37. Emirps are
special cases of prime numbers. A prime
number is an emirp if it is still prime
when its digits are reversed. For
example, 37 is an emirp because not only is it prime,
but so too is 73 (the reverse of 37).
Write a program that will ask for a number. Expect the user to enter only positive
integers from 0 to 32,767. Then tell if
it is: "not prime", "a prime", or "an emirp". The
program should continue until a zero is entered.