🔧

C Intermediate

Conditionals, while loops and nested loops for real algorithms.

3 lessons 5 tasks ⚡ Live compiler
Lessons Compiler Quiz Certificate

📚 Lessons

1 Conditionals & logic

if/else if/else branch on conditions. Combine tests with && and ||.

#include <stdio.h>

int main() {
    for (int n = 1; n <= 5; n++) {
        if (n % 2 == 0) printf("%d even\n", n);
        else printf("%d odd\n", n);
    }
    return 0;
}

2 While loops

A while loop runs while its condition holds — ideal when the iteration count is not known up front.

#include <stdio.h>

int main() {
    int n = 16, steps = 0;
    while (n > 1) {
        n = n % 2 == 0 ? n / 2 : 3 * n + 1;
        steps++;
    }
    printf("steps = %d\n", steps);
    return 0;
}

3 Nested loops

Loops inside loops build grids and tables. Mind complexity: two nested loops over n items is O(n²).

#include <stdio.h>

int main() {
    for (int i = 1; i <= 3; i++) {
        for (int j = 1; j <= 3; j++) printf("%d ", i * j);
        printf("\n");
    }
    return 0;
}

⚡ C Compiler

Code runs on a learning-oriented simulated runtime that supports common constructs (output, variables, arithmetic, conditionals and loops).

C

            

📝 Tasks

5 tasks across 2 pages — multiple-choice and fill-in (type the answer). Score 70% or higher to earn your certificate.

🎓 Certificate of Completion

🔒 Pass the quiz above (70%+) to unlock your downloadable certificate.