Fundamentals8 / 16
Up next

if / else if / else

#include <stdio.h>

int main(void) {
    int n = 7;
    if (n < 0) {
        printf("negative\n");
    } else if (n == 0) {
        printf("zero\n");
    } else {
        printf("positive\n");
    }
    return 0;
}
What you're solving

branch on conditions