#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
int min, max, sumOfSquares;
sumOfSquares = 0;
//scanf_s("%d %d", &min, &max);
while((scanf_s("%d", &min)) != (scanf_s("%d", &max)))
{
for (int i = min; i <= max; i++)
{
sumOfSquares += (i*i);
}
printf("%d", sumOfSquares);
printf("%d %d", min, max);
}
return 0;
}
So basically, I input two integers. One is the min and the next is the max. I get sum of the squares of the min and max and each number in between. I'm not quite sure where it's going wrong. When I input the two numbers, nothing prints out at all, so I'm guessing the while statement is faulty?
Is that not an acceptable format?
Can someone please tell me what is wrong and if possible, point me to the right direction.
Also, I used that while loop like that because it should keep asking me for an input and printing out the sumOfSquares until I enter an input that is equal to each other, like 5 5.