| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
不知错哪了var r,n:longint;
c:char;
begin
read(c);
while c>'0' do
begin
r:=0;
n:=0;
while (c<='9')and(c>='0') do
begin
n:=n+ord(c)-ord('0');
read(c);
end;
while n>0 do
begin
while n>0 do
begin
r:=r+n mod 10;
n:=n div 10;
end;
if r>9 then
begin
n:=r;
r:=0;
end;
end;
writeln(r);
readln;
read(c);
end;
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator