请各位帮我看看我这个程序哪里出了问题,
这个程序要求用户输入一个上限整数和一个下限整数,计算从上限到下限范围内所有整数的平方和。然后循环计算,直到输入上限等于小于下限退出,我写的程序执行第一次没有问题,但是从第二个开始就不对了,是不是for循环递增那里出问题了啊。下面是代码和输出结果,求解决
#include<stdio.h>
#include<string.h>
int main(void)
{
int start, end, sum,count,ep;
sum = 0;
printf("please enter two int number to caculate the sum of all number pingfang\n");
scanf_s("%d %d", &start, &end);
while(start < end)
{
for (count=0; start <=end; start++)
{
sum += start * start;
count++;
}
printf("the sums of the square from %d to %d is %d\n", (start - count) * (start - count), (start-1)*(start-1), sum);
printf("please enter next\n");
scanf_s("%d %d", &start, &end);
}
return 0;
}
