I have written the following code for finding the first palindrome obtained by product of two 3 digit numbers:
#include <stdio.h>
int main()
{
int pro,d,sum=0,c;
for (int a=100;a<1000;a++)
{
for (int b=a;b<1000;b++)
{
pro=a*b;
d=pro;
while (d!=0)
{
c=d%10;
sum= sum*10 + c;
d=d/10;
}
if (sum==pro)
{
printf("%d is a palindrome \n",sum);
return 0;
}
}
}
return 0;
}
But when I run the code it doesn't give me any output. Any helps?