If aValue, i, and n are type int variables, what does the following program fragment do? aValue
Question:
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
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
C# Programming From Problem Analysis To Program Design
ISBN: 9781285096261
4th Edition
Authors: Barbara Doyle
Question Posted: