Aim - WAP To Find Smallest and Largest Among Four Numbers.
Code -
#include<stdio.h>
#include<conio.h>
void main ()
{
int a, b, c, d;
clrscr ();
printf ("Enter The Four Numbers Respectively : ");
scanf ("%d %d %d %d", &a, &b,&c, &d);
if (a>b && a>c && a>d)
printf ("%d Is The Largest Number\n", a);
else if (b>a && b>c && b>d)
printf ("%d Is The Largest Number\n", b);
else if (c>a && b<c && c>d)
printf ("%d Is The Largest Number\n", c);
else
printf ("%d Is The Largest Number\n", d);
if (a<b && a<c && a<d)
printf ("%d Is The Smallest Number\n", a);
else if (a>b && b<c && b<d)
printf ("%d Is The Smallest Number\n", b);
else if (c<b && a<c && c<d)
printf ("%d Is The Smallest Number\n", c);
else
printf ("%d Is The Smallest Number\n", d);
getch ();
}
OUTPUT
Enter The Four Numbers Respectively : 34 53 87 67
87 Is The Largest Number
34 Is The Smallest Number