C program to find greatest in 3 numbers

				
					#include<stdio.h> 
#include<conio.h> 
void main() 
{ 
int a,b,c; 
clrscr(); 
printf(“enter value of a, b & c: ”); 
scanf(“%d%d%d”,&a,&b,&c); 
if((a>b)&&(a>c)) 
// a is greater than b and c 
printf(“a is greatest”);
if((b>c)&&(b>a)) 
// b is greater than c and a 
printf(“b is greatest”); 
if((c>a)&&(c>b)) 
// c is greater than a and b 
printf(“c is greatest”);
getch(); 
}
				
			
Output: 

enter value for a, b& c: 5   7  4

b is greatest

Leave a Reply