3. Write a program for find the max and min from the three numbers.
#include<stdio.h>
void main()
{
int a,b,c;
clrscr();
printf("\n Enter three numbers:\n");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c)
printf("\n Maximum number is a = %d",a);
else if(b>a && b>c)
printf("\n Maximum number is b = %d",b);
else
printf("\n Maximum number is c = %d",c);
if(a<b && a<c)
printf("\n Minimum number is a = %d",a);
else if(b<a && b<c)
printf("\n Minimum number is b = %d",b);
else
printf("\n Minimum number is c = %d",c);
getch();
}
OUTPUT:
Enter three numbers:
54
34
21
Maximum number is a = 54
Minimum number is c = 21
Comments
Post a Comment