| ||||||||||
| 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 | |||||||||
WHY???#include <stdio.h>
void main()
{
int num[5],r[20],i=0,j=0,b;
char a[50],*p=a;
while(1)
{
b=0;
gets(a);
if (a[0]=='0') break;
while(*p!='\0')
{
b+=*p-'0';
p++;
}
p=a;
while(b>=10)
{
while(b>0)
{
num[i++]=b%10;
b/=10;
}
for (b=0;i>0;i--) b+=num[i-1];
}
r[j++]=b;
}
for(i=0;i<j;i++) printf("%d\n",r[i]);
}
为什么runtime error?? 我已经失败N+1次了
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator