Ask Question
15 March, 14:12

Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 counting numbers and store this value in total.

+3
Answers (1)
  1. 15 March, 18:09
    0
    Following are the statement is given below

    Int total=0; / / variable declaration

    int k=1; / / variable declaration

    while (k<=50) / / iterating the loop

    {

    total=total+k*k; / / calculating sum of the squares

    k++; / / increment the value of k

    }

    Explanation:

    Following are the description of the above statement

    Declared a variable total and k of int type. Initialized total to 0 and k to 1. iterating the while loop up to the value 50. In this while calculating the calculating sum of the squares in the total variable. increment the value of k by 1. This loop is executed until 50.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers