NEXT PALINDROME-ALWAYS GETTING WRONG ANSWER

I’ve tried many case it’s working fine.But here i am getting wrong answer here. Could some one help me please. Here is my code
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,a,b,c;
scanf("%d",&n);
while(n>0)
{
printf("\n");
scanf("%d",&a);
for(b=a+1;c!=b;b++)
{
c=b;
b=ispalin(b);
if(c==b)
b–;
else
{
b=c;
continue;
}
}
printf("%d",c);
n–;
}
}
int ispalin(int i)
{
int k,temp,rev=0;
temp=i;
for(;i!=0;)
{
k=i%10;
rev=rev*10+k;
i=i/10;
}
return rev;
}

1 Like

In question it is written that k have 1000000 digits which is not at all supported by scanf… try some other way of taking input…!

@dhivysh123 you have misunderstood the question.
The number is of 1000000 digits, but you might have misunderstood it as 1<=K<=1000000.
1 Like