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
Diano4ka-milaya [45]
4 years ago
8

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. Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total. Use no variables other than n, k, and total.
Computers and Technology
2 answers:
slamgirl [31]4 years ago
8 0

Answer:

total=0;

for(k=1;k<=n;k++){

total+=k*k*k;

}

Just to clarify, the curly brackets are optional when only one operation is done by the loop.

Hope this helps!

LiRa [457]4 years ago
5 0

Explanation & answer:

We do not know which language you are using, so a pseudocode will be given, it will be similar to java or C/C++.  For other languages, you can adapt to the syntax of the target language.

int n=5;

//

total = 0  // initialize  variable to store total value, already declaired.

// k will be used as a dummy variable, already declared

for (k=1; k<=n; k++){

   total+=k*k*k;  // k*k*k works for almost all languages.  adapt as needed

   }

print(n, total)

You might be interested in
Write a function isCString which accepts as arguments a const pointer to a char array and an integer for the size of the array
Umnica [9.8K]

Answer:

Mnnmnkjhsgxlsjzgxfckabxvzuajs

7 0
3 years ago
Which two characteristics of the matter change?
Shtirlitz [24]

Answer:

SNITCH SNATCH THOSE POINTS DONT LOOK BACK

Explanation:

3 0
3 years ago
What advantage does digital storytelling have over oral storytelling traditions?
Marysya12 [62]
Pretty sure the answer is D
6 0
4 years ago
What is A cell that can hold or display data​
g100num [7]

Answer:

excel

Explanation:

5 0
3 years ago
Question 2 if you have a slow computer, what are some possible culprits that could be causing this? select all that apply
Simora [160]

Answer:

too many programs running, computer virus, lack of memory, to much cache

Explanation:

4 0
2 years ago
Other questions:
  • What are the basic steps of programing??
    9·2 answers
  • Which diagrams represent how roles can affect careers and lifestyles
    11·1 answer
  • 8. Seleccione la respuesta correcta de acuerdo con las opciones que aparece a continuación:
    11·1 answer
  • To illustrate a point in a Word document with a simple chart, what commands should you select?
    8·2 answers
  • "Most of us know that when we come into a college classroom, we will see desks and chairs, a computer station and a projector. A
    6·1 answer
  • you just bought a new hard drive for your computer, you plan to use this secondary hard drive to store all school work files. on
    13·1 answer
  • A DBMS makes the: a. relational database available for different analytical views. b. physical database available for different
    12·1 answer
  • PLEASE HELP
    7·2 answers
  • Which statement best describes 'abstraction'? *
    5·1 answer
  • What type of loop allows you to indicate the starting value for the loop control variable, the test condition that controls loop
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!