Kodewick
Start learning →
Starter←→0 / 86

Skip the Fours

#081Startercontinue3 min

The lift calls out floors 1 to 6 but skips 4. Show 1, 2, 3, 5, 6, one per line. You may not delete the cout line — do something before it instead.

Should show
1
2
3
5
6
main.cpp
#include <iostream>
using namespace std;

int main() {
    for (int n = 1; n <= 6; n++) {
        // your code here: if n is 4, do not go on with this round
        cout << n << endl;
    }
    return 0;
}
Ctrl + Enter runs too
Result

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