Here is the code:
#include<stdio.h>
#include<string.h>
short ispalindrome(unsigned long);
int main()
{
unsigned int t;
scanf("%u",&t);
while(t--)
{ unsigned long input;
scanf("%lu",&input);
while(input<1000000&&input>=11)
{
if(ispalindrome(++input))
{
printf("%lu\n",input);
break;
}
}
if(input<11) printf("11\n");
}
return 0;
}
short ispalindrome(unsigned long y)
{
char buff[7];
unsigned int i,j;
sprintf(buff,"%u\0",y);
j=strlen(buff);
for(i=0;i<=j/2-1;i++)
{
if(buff[i]!=buff[j-1-i])
{
return 0;
}
}
return 1;
}
This program running in my pc correctly. Here it’s saying wrong answer. Pls help me what’s wrong with my program ?