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:50
A.) generate scaffolding to create database for your application. develop all the entities identified in assignment #2. add any additional that may be identified later. b.) add data validation rules to the models that are appropriate for your application and data. c.) create links for each scaffold in the header section. part 2: application updates [30 points] a.) add two additional views to the "home" controller you created in assignment #1. b.) the two views should be named as “privacy" and "". c.) link the two newly created views in the footer section. hint: you would need to modify the “home" controller definition and create “privacy.html.erb" and “.html.erb" files in appropriate locations.
Answers: 3
question
Computers and Technology, 22.06.2019 02:30
Write a program that takes in 3 inputs [players (int type), expected game time (double type), team (char type)] and calculates actual game time (double) based on the following conditions: if the number of players or the expected game time is less than or equal to zero, it should output wrong input if the number of players is greater than 0 and less than or equal to 6 and if they are on the â€r’ or â€r’ team, their game time will be 10% faster. and if they are on the â€b’ or â€b’ team, their game time will be 15% faster. and if they are on the â€y’ or â€y’ team, their game time will be 20% faster. and if they are on any other team, they will play 0% faster. if the number of players is greater than 6 but less than or equal to 12 and if they are on the â€r’ or â€r’ team, their game time will be 20% faster. and if they are on the â€b’ or â€b’ team, their game time will be 25% faster. and if they are on the â€y’ or â€y’ team their game time will be 30% faster. and if they are on any other team, they will play 0% faster. if the number of players is greater than 12 but less than or equal to 18 and if they are on the â€r’ or â€r’ team, their game time will be 30% faster. and if they are on the â€b’ or â€b’ team, their game time will be 35% faster. and if they are on the â€y’ or â€y’ team, their game time will
Answers: 2
question
Computers and Technology, 22.06.2019 12:30
An atom's diameter is about 0.1 nanometer (1×10-9m), and a human hair is about 1×10-3m. how many times greater is a human hair than an atom's diameter? sorry pushed wronf button but this is math
Answers: 3
question
Computers and Technology, 22.06.2019 19:30
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
You know the right answer?
Consider the following code segment.

int total = 0;

for (int k = 0; k <=...
Questions
question
Physics, 17.12.2020 04:10
question
Mathematics, 17.12.2020 04:10
question
Mathematics, 17.12.2020 04:10
question
Mathematics, 17.12.2020 04:10
Questions on the website: 13722363