Ask Question
10 March, 23:56

Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do ... while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total. Use no variables other than n, k, and total. 0

+2
Answers (1)
  1. 11 March, 00:26
    0
    Following are the statement:-

    total = 0, k=0; / / variable declaration

    do

    {

    total = total+Math. pow (k, 3); / /perform the operation

    k+ +;

    }while (k<=n);

    Explanation:

    Following are the description of statement:-

    In this we declare a variable total that is initialized with the 0 value. The do while loop is executed at least one time either condition True or False. We Iterating the do while loop until k is less than equal to n. In each iteration we calculate sum of the cube of n whole number.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been ...” 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