Subscribe Us

header ads

To find the Greatest between given Three Numbers



C Program to find the greatest between given three numbers

#include<stdio.h>
#include<conio.h>
void main()
{
    int a,b,c;
    printf("\nEnter any three 
    numbers \n");
    scanf("%d%d%d",&a,&b,&c);
    if(a>b)
    {
        if(a>c)
         printf("\n%d is greatest"
         ,a);
        else
         printf("\n%d is greatest"
         ,c);
    }
    else
    {
        if(b>c)
         printf("\n%d is greatest"
         ,b);
        else
         printf("\n%d is greatest"
         ,c);
    }
    getch();
}

Output :-

Enter any three numbers
5
8
4

8 is greatest

Post a Comment

0 Comments