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 |
输入的整数范围有多大#include<stdio.h> int main() { long number,digit; while(1) { scanf("%ld",&number); if(number==0) break; while(1) { digit=0; do{ digit+=number%10; number/=10; }while(number>0); if(digit<10) break; else number=digit; } printf("%ld\n",digit); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator