C Program

Object:-Write a Program to find greatest number among three numbers

#include<stdio.h><
#include<conio.h>
void main()
{
 int x,y,z,max;
 clrscr();
 printf(“Enter The Three Numbers:”);
 scanf(“%d%d%d”,&x,&y,&z);
 max=x;
 if(y>max&&y>z)
 max=y;
 else
 if(z>max)
  max=z;
  printf(“nThe Greatest Number among %d %d %d is %d”,x,y,z,max);
 getch();
}

Output

Enter The Three Numbers:12
34
23

The Greatest Number among 12  34 23 is 34
 

Explanation

In this program we have find the largest number among the given 3 number.







You may also like: