Question 16
Consider a loop construct in C:
#include <stdio.h>
int main(void) {
int sum = 0;
for (int i = 1; i <= 16; i++) {
if (i % 2 == 0) sum += i;
}
printf("%d", sum);
return 0;
}Detailed Solution
The loop calculates the sum of all even integers from 2 up to 16. Using the arithmetic progression sum formula n/2 * (first + last), the resulting sum is 72.