1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Zina [86]
3 years ago
15

Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have alre

ady been declared, use a for 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.
Mathematics
1 answer:
azamat3 years ago
6 0

Answer:

total = 0;

for (k = 0; k <= n; k++)

total += Math.pow(k,3);

Step-by-step explanation:

Here the variable total is declared and initialized with a value zero  

Then a for loop is defined with a counter k whose initial value is set to zero then a condition for the loop is that the counter k does not exceed n k<=n and then within the loop a statement which add the cube of the counter k to the variable total and still assigns it to the variable total is defined

  total += Math.pow(k,3);

What this program does is to obtain the sum of the cubes of k

You might be interested in
Can you guys please help me on this question ?
dolphi86 [110]

Solution

Therefore, the correct option is D.

6 0
1 year ago
David charges $15 plus $5.50 per hour to mow lawns. Ari charges $12 plus $6.25 per hour to mow lawns. In what situations is Ari'
Tanya [424]
The answer would be 15+$5.50(9)=$64.50 is less than $12+$6.25(10)= 74.50
3 0
4 years ago
What is the area of the figure?<br><br> 21 mm²<br><br> 77 mm²<br><br> 133 mm²<br><br> 154 mm²
joja [24]

Answer:

154

Step-by-step explanation:

7*11+14*4+3*7=77+56+21=154

7 0
3 years ago
Your company purchase a 12 month insurance policy for $36000 in January
bearhunter [10]

please complete the question

7 0
4 years ago
Read 2 more answers
PLEASEEEE HELP ME ASP
Sedbober [7]
The last one! The angles of a triangle add up to 180 ;)
8 0
3 years ago
Other questions:
  • What’s 34 percent of 240? A. 81.6 B. 81 C. 90.6 D. 80
    7·2 answers
  • Find the midpoint of a line segment with given endpoints (4,-5) and (-6,3)
    10·1 answer
  • This is an ADDMATHS QUESTION so I'm not sure if anyone can help me but please try to ㅠ ㅠ: Find the equation of the normal to the
    12·2 answers
  • PLS HELP WILL GIVE BRAINLIEST
    5·2 answers
  • Hey, here are all the problems. Im not sure how to do this and my teacher isnt giving me much time. Help would be apricated
    5·1 answer
  • The diameter of a semicircle is 2 millimeters. What is the semicircle's area?
    8·1 answer
  • Help, please, I don't understand math that well and really wanna pass this year
    13·1 answer
  • How many laps would 50 miles be on a 1/2 mile track?
    11·1 answer
  • Question
    7·1 answer
  • What fraction of a day is 45 minutes
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!