10.编写一个程序,要求用户输入一个上限整数和一个下限整数,计算从上限到下限范围内所有 整数的平方和,并显示计算结果。然后程序继续提示用户输入上限和下限整数,并显示结果,直到 用户输入的上限整数等于或小于下限整数为止。程序的运行示例如下:
Enter lower and upper integer limits: 5 9
The sums of the squares from 25 to 81 is 255
Enter next set of limits: 3 25
The sums of the squares from 9 to 625 is 5520
Enter next set of limits: 5 5
Done
#include <stdio.h>
int main(void)
{
int lower,upper,i;
long sum=0;
printf("Enter lower and upper integer limits:");
while((scanf("%d %d",&lower,&upper)==2)&&lower<upper)
{
for(i=lower;i<=upper;i++)
sum+=i*i;
printf("The sum of squares from %d to %d is %ld\n",lower,upper,sum);
sum=0;
printf("Enter next set of limits:");
}
printf("Done\n");
return 0;
}
11.编写一个程序,在数组中读入8个整数,然后按倒序打印这8个整数。
#include <