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
Lana71 [14]
4 years ago
12

Given that n refers to a positive integer, use a while loop to compute the sum of the cubes of the first n counting numbers, and

associate this value with total. Use no variables other than n, k, and total.
Computers and Technology
1 answer:
Rasek [7]4 years ago
6 0

Answer:

int k = 1;

int total = 0;

while (k <= n){

  total = total + (k*k*k);

  k++;

}

Explanation:

The code above has been written in Java.

Following is the line-by-line explanation of the code written as comments.

// Initialize int variable k to 1.

// variable k is used to control the loop.

// It is initialized to 1 because the positive integers should start at 1.

// Starting at zero will be unimportant since the cube of 0 is still zero and

// has no effect on the overall sum of the cubes.

int k = 1;

// Initialize total to zero(0)

// This is so because, at the start of the addition total has no value.

// So giving it zero allows to cumulatively add other values to it.

// Variable <em>total </em>is also of type int because the sum of the cubes of counting

// numbers (which are positive integers) will also be an integer

int total = 0;

// Now create a while loop to repeatedly compute the sum of the cubes

// while incrementing the counter variable <em>k</em>.

// The condition for the loop to execute is when <em>k</em> is less than or equal to

// the value of variable <em>n.</em>

// The cube of any variable k is given by k^{3} which can be

// written as k * k * k.

// At every cycle of the loop, the cube of the counter <em>k</em> is calculated and

// added cumulatively to the value of <em>total</em>. The result is still stored in the

// variable <em>total. </em>After which <em>k</em> is incremented by 1 (k++).

while (k <= n) {

  total = total + (k*k*k);

  k++;

}

You might be interested in
When selecting a color scheme for a project which two things should you consider?
Vsevolod [243]

colorfulness and depending on your teacher pick colors that will go together on the project

6 0
3 years ago
What is the most important job of a web server?
attashe74 [19]

Answer:

Provide requested web pages to clients; the other tasks listed there are secondary to that.

6 0
3 years ago
Read 2 more answers
What is the digital divide? What does the digital divide mean for the world?
Luda [366]

it mean for some people that have technology like a computer and there are some who don't have access to technology like phones, and tv's

8 0
3 years ago
10) ________ objects control the flow of the application. A) Boundary B) Utility C) Control D) All of the above
Cerrena [4.2K]

There are different kinds of applications.  Control objects control the flow of the application.

<h3>What works the flow of control in a program?</h3>

In computer, control flow or flow of control is known to be a type of an order function calls, instructions, and statements.

They are known to be used in the execution or in an evaluation when a specific program is running. Note that a lot of programming languages have the control flow statements, that helps to know the section of code is run in a program at any given time.

Learn more about application from

brainly.com/question/23275071

7 0
2 years ago
One property of light that makes it possible to record the image of an object with the camera
KengaRu [80]

Answer:

Reflection

Explanation:

Reflection is the property of light in which when a ray of light hits a smooth surface, it bounces back in the direction in which it came from. If i is the angle between the normal to the surface and the incident ray, and r is the angle between the normal and reflected ray, the law of reflection states that the angle of incidence equals the angle of reflection. That is, i = r.

So, to record the image of an object with a camera, one property of light that makes that possible is reflection because, the incidence rays form an image of the object in the camera, while the reflected rays reflect the image so that it is visible to the eye.

7 0
3 years ago
Other questions:
  • PLS HURRY!! This OS introduced a very cool GUI that had animations and transparencies.
    5·1 answer
  • If an ARQ algorithm is running over a 40-km point-to-point fiber optic link then:
    12·1 answer
  • Dwight <br> d. eisenhower was impressed with germany's network of highways and how it __________.
    15·1 answer
  • how can you create fades with the smart tool? How can you specify the types of fade curves that are used with the smart tool?
    13·1 answer
  • What is NOT an issue associated with tag management systems? There is no automation available for tag management systems. Managi
    5·1 answer
  • Write a Racket two-way selection structure that will produce a list '(1 2 3) when the first element of a list named a_lst is ide
    13·1 answer
  • 2. Discuss CORBA functions<br><br>​
    6·2 answers
  • Who know's web Design
    12·1 answer
  • What is the output for the following program?
    6·1 answer
  • What must your motherboard have to use bitlocker encryption in windows 7 which will ensure that your hard drive cannot be used i
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!