subject

Consider the following code segment.

int total = 0;

for (int k = 0; k <= 100; k += 2)

{

total += k;

}

Which of the following for loops could be used to replace the for loop in the original code segment so that the original and the revised code segments store the same value in total?

for (int k = 0; k < 100; k += 2)

{

total += k + 1;

}

A

for (int k = 1; k < 101; k += 2)

{

total += k - 1;

}

B

for (int k = 0; k <= 101; k += 2)

{

total += k + 1;

}

C

for (int k = 1; k <= 101; k += 2)

{

total += k + 1;

}

D

for (int k = 1; k <= 101; k += 2)

{

total += k - 1;

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
Search the web for two examples of digital art that you like. the examples must be from different mediums (example: one digital photo and one computer animation not two computer animations). compose an essay for each example you choose about why the piece appeals to you, and identify the medium used.
Answers: 1
question
Computers and Technology, 22.06.2019 13:00
Which option should u select to ignore all tracked changes in a document
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen too
Answers: 2
question
Computers and Technology, 22.06.2019 18:00
Suppose an astronomer discovers a large, spherical-shaped body orbiting the sun. the body is composed mostly of rock, and there are no other bodies sharing its orbit. what is the best way to categorize this body? a. planet b. moon c. comet d. asteroid
Answers: 1
You know the right answer?
Consider the following code segment.

int total = 0;

for (int k = 0; k <=...
Questions
question
Mathematics, 27.08.2019 05:50
question
Social Studies, 27.08.2019 06:00
question
Physics, 27.08.2019 06:00
Questions on the website: 13722367