Sunday, September 29, 2013

Find largest value among three numbers using conditional statement

Find largest value among three numbers using conditional statement
Find largest value among three numbers using conditional statement  in C

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

No comments:

Post a Comment