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

为什么WA?哪位大牛帮忙看下哪里出问题?

Posted by optimusprime5 at 2013-05-19 20:54:05 on Problem 1519
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int aim,anwser;
    while(1){
        scanf("%d",&aim);
        if(aim==0)
            break;
        while(1){
            anwser=0;
            while(aim!=0){
                anwser+=aim%10;
                aim/=10;              
            }         
            if(anwser<10)
                break;
            else
                aim=anwser;
        }
        printf("%d\n",anwser);
    }
  return 0;
}

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