Nested if-else C Program to show use of Nested If Statements to test multiple conditions

C Programming Language Decision Making of C Language (Article) Decision Making of C Language (Program)

1047

Program:

// C Program to show use of Nested If Statements to test multiple conditions
#include"stdio.h"
int main(){
    int num;
     
    printf("Enter a numbers\n");
    scanf("%d", &num);
    /* Using nested if statement to check two conditions*/
    /* Outer if statement */
    if(num < 400){
        printf("First Condition is true\n");
        if(num > 100){
            printf("First and Second conditions are true\n");
        }
    }
    printf("This will print always\n");
     
     
    return(0);
}

Output:

case1:
Enter a numbers
80
First Condition is true
This will print always
Press any key to continue . . . 
case2: Enter a numbers 200 First Condition is true First and Second conditions are true This will print always Press any key to continue . . .
case3: Enter a numbers 700 This will print always Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.