/* Finding the biggest of 3 numbers using if...else - BIGIFEL.C */
# 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)
{
if(a > c)
printf("\n%d is the biggest number", a) ;
else
printf("\n%d is the biggest number", c) ;
}
else
{
if(c > b)
printf("\n%d is the biggest number", c) ;
else
printf("\n%d is the biggest number", b) ;
}
getch() ;
}
RUN 1 :
~~~~~~~
Enter three numbers : 10 20 30
30 is the biggest number
RUN 2 :
~~~~~~~
Enter three numbers : 20 30 10
30 is the biggest number
RUN 3 :
~~~~~~~
Enter three numbers : 30 10 20
30 is the biggest number
No comments:
Post a Comment