Ask Question
16 September, 19:18

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.

+2
Answers (1)
  1. 16 September, 22:43
    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?
Find 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 and Technology 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