c语言中计算两个整数之间的所有整数的和
1、
#include <stdio.h>
int main(void)
{
int a,b;
puts("please input two integers.");
printf("a = "), scanf("%d", &a);
printf("b = "), scanf("%d", &b);
int sum = 0;
do
{
sum = sum + b;
b = b + 1;
}
while (b <= a );
printf("sum = %d.\n", sum);
return 0;
}