this program is to find the largest palindrome of 3 digit numbers.this code is workig for two digit numbers but it is not working for 3 digit numbers.
``
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,j,con=0;
long int num=0,res=0;
clrscr();
for(i=999;i>900;i--)
{
for(j=999;j>i;j--)
{
num=(i*j);
con=pal(num);
if(con==0&&num>=res)
res=num;
}
}
printf("\npalindrome is %lu",res);
getch();
}
int pal(long int a)
{
long int b=0,c=a;
while(a!=0)
{
b=(b*10)+(a%10);
a=a/10;
}
if(c==b)
return 0;
else
return 1;
}
`
on executing above code the output is 32723 but the out should be 906609..