s:=inttostr(N); k:=length(s); setlength(s1,k); for i:=1 to length(s) do s1[i]:=s[k-i+1]; N:=StrToInt(s1);