Program to find greatest number among three numbers using if statement in c language.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("enter three numbers=");
scanf("%d%d%d",&a,&b,&c);
if(a>=b && a>=c)
printf("%d is greater",a);
if(b>=a && b>=c)
printf("%d is greater",b);
if(c>=a && c>=b)
printf("%d is greater", c);
getch();
}
■》 Output->
enter three numbers=>
5
3
9
9 is greater.
Comments
Post a Comment