basics · beginner · ~15 min

Smaller of two

Mirror the max logic for the minimum.

Challenge

Implement int min2(int a, int b) returning the smaller value.

Starter code

int min2(int a, int b) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.