I have written my code in c for GCC compiler and I assume the code to be correct but whenever I try to upload my code, it shows wrong answer.
I myself tried running it on different IDEs with the test cases provided in the comments section and it displayed correct output each and every single time.
I am attaching My code.Please Do Help.
include
int palindrone(int n)
{
int k,rev=0,rem=0;
for(k=n;k>0;k=k/10)
rev=rev*10+k%10;
if(rev==n)return 1;
return 0;
}
int main()
{
int k;
scanf("%d\n",&k);
while(k)
{
int p,i;
scanf("%d\n",&p);p++;
while(!palindrone(p))
p++;
printf("%d\n",p);
k--;
}
return 0;
}