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 |
用串读, int 太小了,In Reply To:这个程序哪儿错了? Posted by:hz02ruc at 2003-11-08 23:47:05 > #include<stdio.h> > int n; > void find_digitalroot() > { > int sum=100,count=0; > while(sum>=10) > { > > if(count>=1) > n=sum; > sum=0; > while(n>0) > { > sum+=n%10; > n/=10; > } > count++; > } > printf("%d\n",sum); > } > int main() > { > scanf("%d",&n); > while(n!=0) > { > find_digitalroot(); > scanf("%d",&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