So I'm new to SPOJ, and i've got this non-zero exit code... this is the code
program PALIN;
var n,i,pal:longint;
function nxtpal(a:longint):longint;
var tpal,t:longint;
begin
tpal:=a;
t:=0;
while (tpal>0) do begin
t:= (t*10) + (tpal mod 10);
tpal:=tpal div 10;
end;
if (a <> t) then a:=nxtpal(a+1);
nxtpal:=a;
end;
begin
readln(n);
for i:=1 to n do begin
readln(pal);
//if (pal<10) then writeln(11)
//else begin
pal:=nxtpal(pal+1);
writeln(pal);
//end;
end;
end.
What does this code actually done is that the [color=#BF4000]function nxtpal[/color] is searching for the next palindrome number starting from (n+1), and the [color=#BF4000]commented section[/color] is because in the comment some people says for n=1 to 9 the output should be 11. As what i saw nothing is wrong with my code, but i always got NZEC, when i run it on ideone.com it got compiled and run properly, producing the right answer... what's wrong with my code? is something not possible done in SPOJ?