#include
void main()
{
int a,b,sum=0;
printf("请输入两个正整数:\n");
scanf("%d %d",&a,&b);
if(a>b)
{
int temp;
temp=a;a=b;b=temp;
}
for(int i=a;i<=b;i++)sum+=i;
printf("两者之间所有正整数的和为:%d\n",sum);
}
int main()
{
int a;
int b;
printf("%d\n",a==b?0:(a>b?(a-b-1):(b-a-1)));
return 0;
}
#include
int main()
{
int a, b;
int sum;
int temp;
printf("input two integrated number:\n");
scanf("%d%d",&a, &b);
if (a < b)
{
temp = a;
a = b;
b = temp;
}
sum = (a + b)*(a - b + 1) / 2;
printf("sum:%d\n",sum);
return 0;
}