Ask 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 counting numbers and store this value in total.

+2
Answers (1)
  1. 27 April, 13:58
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers