C Program to check the greatest of three numbers
#include <stdio.h>
int main()
{
int a,b,c;
printf("Enter three numbers :\n ");
scanf("%d\n%d\n%d",&a,&b,&c);
if (a>b && a>c)
{
printf("%d is greater",a);
}
else if(b>c)
{
printf("%d is greater",b);
}
else
{
printf("%d is greater",c);
}
return 0;
}
Output:
Explanation:Hi, in this program we accept three integers as input and check the condition if a>b and a>c print a is greater , else if b>c print b is greater , else print c is greater.
Tags:
c programming examples