Program to find greatest of three numbers


Program to find greatest of three numbers


#include <stdio.h>
#include <conio.h>

void main()
{
int a;
int b;
int c;

clrscr();

printf("\nEnter the first number : ");
scanf("%d",&a);

printf("\nEnter the second number : ");

scanf("%d",&b);

printf("\nEnter the third number : ");

scanf("%d",&c);

if(a>b && a>c)
{
printf("\n%d is Greatest",a);
}

else if(b>a && b>c)
{
printf("\n%d is Greatest",b);
}

else if(c>a && c>b)
{
printf("\n%d is Greatest",c);
}
else
{
printf("\nAll are equal");
}
getch();
}

Output :

0 comments:

Post a Comment