Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

不知错哪了

Posted by shenfangyi at 2005-12-27 21:29:27 on Problem 1519
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator