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 while statement that prints all even numbers between 1 and 100 to the screen.
Marrrta [24]

Answer:

Following are the while loop in c language.

while(i<100)

   {

if(i%2==0)

{

printf("%d",i);

printf("\n");

}

++i;

 }

Explanation:

Following are the code in c language.

#include<stdio.h> // header file

int main() // main function

{

   int i=1; // variable declaration

   while(i<100) // check the condition between 1 to 100

   {

if(i%2==0) // check that number % 2 ==0

{

printf("%d,",i); // print the number

}

++i;

 }

   return 0;

}

Output:

2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,

 

8 0
3 years ago
A formula might be used to add expenses in a spreadsheet. True False<br><br> i will mark brainlist
7nadin3 [17]

Answer:

i think its true

Explanation:

3 0
3 years ago
The ______ identifies the path for the currently open folder
skelet666 [1.2K]

The answer to this question is called Directory Paths. Directory Paths because most of the time they include one or more paths to the folder.

8 0
4 years ago
Read 2 more answers
Mation about which osi layers of connected cisco devices can be verified with the show cdp neighbors comm
fgiga [73]
The show CDP neighbor command operates at the Data link layer (Layer 2)

Cisco Discovery Protocol (CDP) is a proprietary Data Link Layer protocol developed by Cisco Systems. It is used to share information about other directly connected Cisco equipment, such as the operating system version and IP address.

6 0
3 years ago
A ___ block unauthorized access to a network or an individual computer
valkas [14]
Firewall is the answer.
3 0
3 years ago
Other questions:
  • If you delete a view, account administrators can recover the view using the "trash can" function within how many days?
    7·2 answers
  • What are the three main components of an IF function?
    12·1 answer
  • 10^4+10-2=<br>10^4+10-2=
    12·2 answers
  • Kayle is building a web form. He has included space where users can input their phone numbers and email addresses. However, he w
    15·1 answer
  • How many frames per second can a half duplex traditional gigabit ethernet handle?
    12·1 answer
  • How much do high-end earners make as power plant operators? Type answer as numerical number.
    14·1 answer
  • Fill in the blanks in the SQL statement below that will list the invoice number, invoice total and credit which is the total sum
    14·1 answer
  • Match the correct answers with the statements.
    14·2 answers
  • If a flagged word is spelled correctly, such as many of our names, right-click it and then click ____ on the shortcut menu to in
    15·1 answer
  • ____ increase network performance by reducing the number of frames transmitted to the rest of the network
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!