C Primer Plus第六章第十题:
int main()
{
int low, up, t;
int sum = 0;
printf("Enter lowe and upper integer limits:");
scanf("%d %d", &low, &up);
t = low;
while (low < up)
{
sum = 0; //在每次循环前重置 sum
t = low;
for (low; low < up + 1; low++)
{
sum = sum + low * low;
}
printf("The sum of tje squares from %d to %d is %d\n", t * t, up * up, sum);
printf("Enter next set of limits:");
scanf("%d %d", &low, &up);
}
printf("Done");
return 0;
}