All modules Download notes (.txt) Warm-upCoreStretchTry these in the playground →
Beginner -- Module 02
Control Statements
if/else, switch, while, do-while, and for -- plus the break/continue traps that catch almost everyone once. Includes a section on why C has no boolean type (until C23).
Video lesson
Downloadable notes
Plain-text lecture notes for Control Statements.
Practice problems
FizzBuzz, strictly
Print 1..30, replacing multiples of 3 with "Fizz", 5 with "Buzz", both with "FizzBuzz".
Menu-driven calculator
Use a switch on a char operator (+, -, *, /) to compute a result from two doubles, guarding divide-by-zero.
Collatz step counter
For a given n, count how many steps the Collatz sequence takes to reach 1 using a do-while loop.
Module quiz
1. What does `continue` do inside a for loop?
2. A switch statement without a break in a case will:
3. In C, which value is considered false in a condition?
4. A do-while loop guarantees the body executes: