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
Get step-by-step solutions from verified subject matter experts
