I m getting wrong answer with this Palin problem. Its running successfully with ideone. I tried with large input also it gave me the correct answer. I m not able to understand whats the problem with my code. Can someone help me with this.
Here is the code:
#include <iostream>
#include<stdio.h>
using namespace std;
void palin(unsigned int);
int main()
{
unsigned int n;
int t;
scanf("%d",&t);
while(t--)
{ scanf("%u",&n);
palin(++n);
}
return 0;
}
void palin(unsigned int n)
{ unsigned int i,x=n,rev=0;
for(i=n;i>0;)
{ rev=rev*10+i%10;
i=i/10;
}
if(x==rev)
{ printf("%u\n",x);
}
else
palin(n+1);
}