Program to find greater number among three numbers using if else in c-language
#include<stdio.h>
int main()
{
int a,b,c;
printf("Enter first number\n");
scanf("%d",&a);
printf("Enter second number\n");
scanf("%d",&b);
printf("Enter third number\n");
scanf("%d",&c);
if(a>b&&a>c)
{
printf("Greatest number is=%d",a);
}
else if(b>a&&b>c)
{
printf("Greatest number is=%d",b) ;
}
else
{
if(c>a&&c>b)
{
printf("Greatest number is=%d",c);
}
else
{
printf("All number are equal");
}
}
}
OUTPUT
Enter first number
67
Enter second number
7
Enter third number
78
Greatest number is=78
By the help of this program you can compare three number and the largest number .And using this concept you can make many program of comparing 4 digit and more digit program.
If you like this program then you can share it and for any issues you can direct contact with me from Home Page.
For regular updates you can also follow my site.
Visit Homepage
Comments
Post a Comment