subject

The following code is intended to calculate the sum of the first five positive even integers starting at 2.

int sum = 2;
int k;
for(k = 4; k < = 12; k += 2)
{
sum += k;
}

what is wrong with this code segment?

the segment calculates the sum of the first four positive even integers.
the segment calculates the sum of the first six positive even integers.
the segment calculates the sum of the first seven positive even integers.
the variable sum is incorrectly initialized. the segment would work correctly if sum was initialized to 0.
the segment works as intended.

ansver
Answers: 3

Another question on Advanced Placement (AP)

question
Advanced Placement (AP), 23.06.2019 19:30
Want fre points & brainliest? answer this drivers ed question correctly and i got you : ) where do you not need to look before you change lanes or pass another vehicle? a. out your window toward your target lane b. in your rearview mirror at cars behind you c. over your shoulder, at your blind spot d. inside the vehicle you plan on passing
Answers: 2
question
Advanced Placement (AP), 24.06.2019 19:00
Melissa is fearful of men and refuses to go on dates. her therapist suggests that she is fearful because she was sexually abused when she was young. the therapist's suggestion most clearly reflects a perspective. a.) humanistic b.) behavioral c.) biological d.) psychoanalytic e.) sociocultural
Answers: 1
question
Advanced Placement (AP), 25.06.2019 19:00
Which of the following characterize the historical move toward urbanization? i. increase in pollution ii. increase in frequency of natural disasters iii. increase in incidence of infectious disease a. i b. ii c. i and ii d. i and iii e. i, ii and iii
Answers: 1
question
Advanced Placement (AP), 25.06.2019 20:00
When you are driving slowly in the freeway fast lane, blocking traffic which wishes to pass you should
Answers: 1
You know the right answer?
The following code is intended to calculate the sum of the first five positive even integers startin...
Questions
question
Social Studies, 24.10.2020 02:40
question
Social Studies, 24.10.2020 02:40
question
History, 24.10.2020 02:40