C-18-Q102mediumsingle_mcq
Inside the 1-to-50 sum loop, which line accumulates the running total?
Inside the 1-to-50 sum loop, which line accumulates the running total?
- a
sum = count - b
sum = sum + count - c
count = count + sum - d
sum = sum - count
ব্যাখ্যা
The accumulator pattern adds the current counter value to a running total each iteration with sum = sum + count. This repeatedly updates sum so that after the loop it holds the complete total.