Nesting if in C programming

In C, nesting if statements include using a combination of if, else, and else statements as well as one or more if statements inside another if statement. You can use this to make your program's conditional logic more intricate. How to nest if statements in C is shown here.

#include <stdio.h>
#include<conio.h>

int main() {
    int n = 10;

    if (n > 0) {
        printf("number is positive.\n");

        if (n % 2 == 0) {
            printf("number is even.\n");
        } else {
            printf("number is odd.\n");
        }
    } else if (n == 0) {
        printf("number is zero.\n");
    } else {
        printf("number is negative.\n");
    }

    getch();
}

'If' statements are nested in this example. The inner 'if' and 'else' statements further examine whether 'n' is even or odd after the outer 'if' has determined whether num is greater than zero.