Kodewick
Start learning →
Basic←→0 / 70

Bus timetable

#023BasicLoopsOutput5 min

The morning bus runs from 6:00 to 8:00, every 20 minutes. m is minutes since midnight (360 is 6:00). Show one line per bus, like 6:20: the hour is m / 60, the minutes are m % 60, padded to two digits with %02d.

Should show
6:00
6:20
6:40
7:00
7:20
7:40
8:00
main.c
#include <stdio.h>

int main(void) {
    for (int m = 360; m <= 480; m += 20) {
        // your code here: printf the time as hours:minutes
    }
    return 0;
}
Ctrl + Enter runs too
Result

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