Kodewick
Start learning →
Basic←→0 / 70

Best jump

#037BasicFunctions4 min

In the long jump everyone gets three tries, a, b and c (in cm); find the longest. max2(a, b) is already written and returns the bigger of two. Write best_jump(a, b, c) to return the biggest of the three using max2.

Examples
best_jump(310, 342, 298)→342
best_jump(250, 250, 250)→250
The functionint best_jump(int a, int b, int c)
main.c
int max2(int a, int b) {
    if (a > b) {
        return a;
    }
    return b;
}

int best_jump(int a, int b, int c) {
    // your code here: return the biggest of the three with max2
    return 0;
}
Ctrl + Enter runs too
Result

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