Ask Question
26 September, 06:01

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.

+5
Answers (1)
  1. 26 September, 06:32
    0
    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);
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “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 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers