| ||||||||||
| 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 int n,sum;
while(1)
{
scanf("%ld",&n);
if(n==0)break;
while(n/10)
{
sum=0;
while(n)
{
sum+=n%10;
n/=10;
}
n=sum;
}
printf("%ld\n",n);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator