Largest among 3 variables using nested if

Largest among 3 variables using nested if

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn C programming concepts. You can learn C language at your own speed and time. One can learn concepts of C language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Largest among 3 variables using nested if
Largest among 3 variables using nested if

Write a C program to Largest among 3 variables using nested if

PROGRAM: Largest among 3 variables using nested if

/* Find largest among 3 variables using nested if */

#include <stdio.h>
int main()
{
    int a,b,c;
    printf(“Enter 3 numbers: \n”);
    scanf(“%d %d %d”,&a,&b,&c);
    if(a>=b)
    {
        if(a>=c)
            printf(“%d is largest”,a);
        else
            printf(“%d is largest”,c);
    }
    else if(b>=c)
        printf(“%d is largest”,b);
    else
        printf(“%d is largest”,c);
    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *