Skip to main content

Beginner-Friendly Topic

Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!

Lesson 8 of 8

Practice & Quiz - Control Flow

Consolidate your knowledge of if/else, switch, loops, break/continue, and goto with a practical exercise and 5 quiz questions.

10 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Practical Exercise

Practical Exercise
/* fizzbuzz.c - all control flow in one program */
#include <stdio.h>

static int classify(int n) {
    if (n % 15 == 0) return 3;
    if (n % 3  == 0) return 1;
    if (n % 5  == 0) return 2;
    return 0;
}

int main(void) {
    int counts[4] = {0};

    for (int i = 1; i <= 100; i++) {
        int cat = classify(i);
        counts[cat]++;
        switch (cat) {
            case 1: printf("Fizz
");     break;
            case 2: printf("Buzz
");     break;
            case 3: printf("FizzBuzz
"); break;
            default: printf("%d
", i);   break;
        }
    }

    printf("
Numbers=%d  Fizz=%d  Buzz=%d  FizzBuzz=%d
",
           counts[0], counts[1], counts[2], counts[3]);
    return 0;
}
/* gcc -Wall -std=c99 fizzbuzz.c -o fizzbuzz && ./fizzbuzz */

Module Quiz

Module Quiz
Question 1 of 5

In C, what value is 'false' in a conditional?

Tip

Tip

Practice Practice Quiz Control Flow in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.

Diagram
Loading diagram…

Process virtual address space organizes code, static variables, heap, and call stack

Practice Task

Note

Practice Task - (1) Write a working example of Practice Quiz Control Flow from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.

Common Mistake

Warning

A common mistake with Practice Quiz Control Flow is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready c code.

Topics in This Module

0/8 done