#include
int main( )
{
int num,sum=0;
while(1)
{
printf("数值:");
scanf("%d",&num);
if(num<0)
{
printf("输入错误\n");
break;
}
sum=sum+num;
if(sum>10)
{
printf(" 和:%d\n",sum);
break;
}
}
return 0;
}
#include
int main( )
{
int num,sum=0;
while(1)
{
printf("数值:");
scanf("%d",&num);
if(num<0)
{
printf("输入错误\n");
break;
}
sum=sum+num;
if(sum>10)
{
printf(" 和:%d\n",sum);
break;
}
}
return 0;
}