Search C Program

Loading...

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;
}


Related Posts
Largest value among three variables
http://cbasicprogram.blogspot.in/2012/02/largest-value-among-three-variables.html

Find largest value among three variable - conditional operator
http://cbasicprogram.blogspot.in/2012/01/find-largest-value-among-three-variable.html

No comments:

Post a Comment