Question: If aValue, i, and n are type int variables, what does the following program fragment do? aValue = 0; n = 10; for (i =

If aValue, i, and n are type int variables, what does the following program fragment do?

aValue = 0; n = 10;

for (i = n; i > 0; i--)

if (i % 2 == 0)

aValue = aValue + i;

a. computes the sum of the integers from 1 through n

b. computes the sum of the integers from 1 through n - 1

c. computes the sum of the even integers from 1 through n

d. computes the sum of the odd integers from 1 through n

e. none of the above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Systems Analysis Design Questions!