Use two variables k and total to write a for loop to compute the sum of the squares of the first 50 counting numbers, and store this value in total. thus, your code should put 1*1 2*2 3*3 ... 49*49 50*50 into total. use no variables other than k and total.

Respuesta :

I think the question means to "accumulate" or "sum" the individual squares in total.   "Store" in computer terms usually means overwriting what's already in total.

With the sens of "summing" or "accumulating", this is one way how it can be coded:

int total=0;
for k=1 to 50 {
    total+=k^2;
};
print(total);