- 数字反转
- 2014-12-23 18:15:42 @
var
n:string;
i,k:longint;
begin
readln(n);
if n[1]='-' then
begin
write(n[1]);
delete(n,1,1);
end;
k:=length(n);
while n[k]='0' do
begin
delete(n,k,1);
k:=k-1;
end;
for i:=length(n) downto 1 do
write(n[i]);
end.
1 条评论
-
琉璃盏 LV 10 @ 2014-12-24 20:55:55
var
a:string;
b:array[1..255]of integer;
c,i,s:integer;
begin
readln(a);
if a[1]='-' then
begin
write('-');
c:=2;
end
else c:=1;
s:=length(a);
for i:=c to s do
b[i]:=ord(a[i])-48;
i:=s;
while b[i]=0 do
begin
s:=s-1;
i:=i-1;
end;
for i:=s downto c do write(b[i]);
end.呵呵
- 1