• 11-18-2012
hss1194
I have a working code that takes a number and its square to check the reverse of the number and see if it matches a reverse of the original square.

Code:

```#include<iostream> #include<conio.h> using namespace std; int reverse(int i) {     int temp=i, sum=0;     while(temp)     {         sum*=10;         sum += temp%10;         temp/=10;     }     return sum; } int square(int i) {     return i*i; } void main() {     for(int i=1; i<10001; i++)     {         if(i>9)         {             if(i!=reverse(i))             {                 if(square(reverse(i))==reverse(square(i)))                 {                     cout<<"The number "<<i<<" squares to "<<square(i)<<endl;                     cout<<"The number "<<reverse(i)<<" squares to "<<square(reverse(i))<<endl;                     cout<<endl;                 }             }         }     }     getch(); }```
An output answer that would be correct for example:

The number 12 squares to 144
The number 21 squares to 441

However, I want to remove answers with leading zeroes that are included in the output, such like:

The number 20 squares to 400
The number 2 squares to 4
• 11-19-2012
std10093
First mind that a typical main is like
Code:

```int main() {     ....     return 0; }```
Also i have to admit that i do not get what is the question.
• 11-19-2012
King Mir
So if the number is devisible by 10, then skip it. That's !(i%10).