Sorry to respond so late...
You are off to a good start. I suggest that you move the stuff that determines whether or not the number is prime into a function called "isPrime":
bool isPrime( int number );
Then you can use it like
1 2 3 4 5 6 7 8
|
for (numb=1; numb<=100; numb++)
{
if (isPrime( numb ))
{
// I've found a possible emirp (because
// it is prime --it has passed the first test)
}
}
|
Now, I've noticed you've got the idea to reverse a number. Good idea. Your reverse() function should work very simply. Remember, to get the ones place, use the remainder function:
ones_place_value = number % 10;
To shift the number down, simply divide by ten:
number /= 10;
To shift a number UP, multiply by ten:
result *= 10;
You'll need to use a loop to shift the one's digit out of 'number' and into 'result'. Think a little about it and when to stop. You'll get it fine.
Back to main(). Once you know the number is prime, all you have to do is reverse it. If the reverse is equal to the prime, it is not an emirp. If it is different, and if the reverse is also prime, then you can print the number.
Hope this helps.