Skip to the task
Layout
Back to classic view

You are looking ahead. Your place is still task 1: Style.

CHECKTask 21 of 23 · step 9: Drills: check yourselfHow many times will it stop?
How many times will it stop? in practice/04/

A breakpoint on sum += i;. How many times will the program stop, what will i be, and what is sum after the loop?

Details & hint
int sum = 0;
for (int i = 0; i <= 3; i++) {
    sum += i;
}

Stuck? 4 times: i = 0, 1, 2, 3 (<=, so 3 too). After the loop sum = 0 + 1 + 2 + 3 = 6.

practice 04 CMakeLists.txt Code Diff
UNCHANGED This step does not change this file.
add_executable(p04_average main.c)
target_link_libraries(p04_average PRIVATE course_input)