Advanced Placement (AP)
Advanced Placement (AP), 09.12.2019 05:31, olson1312

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?

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

{

total += k + 1;

}

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

{

total += k - 1;

}

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

{

total += k + 1;

}

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

{

total += k + 1;

}

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

{

total += k - 1;

}

answer
Answers: 1

Other questions on the subject: Advanced Placement (AP)

image
Advanced Placement (AP), 23.06.2019 06:00, destinybonmer
Here is a quote from an npr news article: “on average, working-age adults were eating about 78 fewer calories per day in 2010, compared with five years earlier. the new report is based on data from the national health and nutrition examination survey, which collects details on eating habits and other health-related information from a nationally representative sample of about 10,000 people in the u. s.” which of the following is true about the numerical value 78? a. it is an anecdote. b. it is a parameter. c. it is a simulation. d. it is a statistic.
Answers: 1
image
Advanced Placement (AP), 23.06.2019 12:50, vvkaitlynvv4982
Free points + brainliest ! only for correct answer when a vehicle is in motion, it has a. no weight b. no inertia c. potential energy d. kinetic energy
Answers: 2
image
Advanced Placement (AP), 24.06.2019 08:00, cheyennebrooke01
Which statements describe continental crust? select the three correct answers. a-it is formed in all parts of the continents. b-it is made mostly of volcanic rock. c-it is destroyed by melting near the top of the mantle. d-it is less than 10 km thick. e-its ages ranges from very young to more than 4 billion years old.
Answers: 2
image
Advanced Placement (AP), 24.06.2019 15:00, cathiprofastde4766
Atotal of 980 students were asked what their favorite holiday was and 525 students said christmas what percent of students said christmas was their favorite holiday
Answers: 2
Do you know the correct answer?
Consider the following code segment.

int total = 0;

for (int k = 0; k <...

Questions in other subjects:

Konu
Arts, 01.10.2021 20:50