注意:
(1)scanf输入多个时中间必须有空格
(2)及时让s=0
include[HTML_REMOVED]
using namespace std;
int main()
{
int a=1,b=1,i,s;
while(a>0&&b>0)
{
scanf(“%d %d\n”,&a,&b);
if(a<=0||b<=0)
break;
if(a>b)
{
s=0;
for(i=b;i<=a;i)
{
printf(“%d “,i);
s=s+i;
}
printf(“Sum=%d\n”,s);
}
else if(a==b)
printf(“%d Sum=%d\n”,a,a);
else if(a<b)
{
s=0;
for(i=a;i<=b;i)
{
printf("%d ",i);
s=s+i;
}
printf("Sum=%d\n",s);
}
}
return 0;
}