if_else if_else

A user can decide among multiple options. The C if statements are executed from the top down. As soon as one of the conditions controlling the if is true, the statement associated with that if is executed, and the rest of the C else-if ladder is bypassed. If none of the conditions are true, then the final else statement will be executed. 
Syntax: 

if (condition)

{

statement;

}

else if (condition)

{

statement;

}

.

.

.

else

{

statement;

}


Flowchart:





1.Write a program to find greatest of four numbers.  

#include<stdio.h>

void main()

{

    int a,b,c,d;

    printf("Enter the four numbers=\n");

    scanf("%d%d%d%d",&a,&b,&c,&d);

    if(a>b&&a>c&&a>d)

    {

        printf("The %d is greatest Number",a);

    }

    else if(b>a&&b>c&&b>d)

    {

        printf("The %d is greatest Number",b);

    }

    else if(c>a&&c>b&&c>d)

    {

        printf("The %d is greatest Number",c);

    }

    else

    {

        printf("The %d is greatest Number",d);

    }

}

Output: