Ask Question
18 April, 18:30

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. 18 April, 18:39
    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?
Find 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 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