Kodewick
Start learning →
Starter←→0 / 70

Egg cartons

#019StarterLoopsOutput3 min

A carton holds 6 eggs. The loop counts from 1 carton to 5; show one line each time round, like 3 x 6 = 18: the cartons, times 6, and the number of eggs.

Should show
1 x 6 = 6
2 x 6 = 12
3 x 6 = 18
4 x 6 = 24
5 x 6 = 30
main.c
#include <stdio.h>

int main(void) {
    for (int c = 1; c <= 5; c++) {
        // your code here: printf c x 6 = the number of eggs
    }
    return 0;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.