Search C Program

Largest value among three variables

/* Largest value among three variables */

#include<stdio.h>
int main()
{
    int a,b,c;
    printf("Enter value of a: ");
    scanf("%d",&a);
    printf("Enter value of b: ");
    scanf("%d",&b);   
    printf("Enter value of c: ");
    scanf("%d",&c);       
   
    if(a >= b && a >= c)
        printf("%d is largest",a);
    else if(b >= a && b >= c)
        printf("%d is largest",b);
    else if(c >= a && c >= b)
        printf("%d is largest",c);
    return 0;
}


Related Posts
Largest among 3 variables using nested if
http://cbasicprogram.blogspot.in/2012/02/largest-among-3-variables-using-nested.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