This is a C program which finds out the smallest and biggest numbers of 3 numbers.Here we use 2 functions smallest() and biggest() to check for the smallest and biggest number respectively.
PROGRAM :
OUTPUT :
PROGRAM :
#include <stdio.h>
#include <stdlib.h>
int smallestNumber(int a,int b ,int c);
int biggest(int a,int b ,int c);
int main()
{
int a,b,c;
printf("Enter First Number: \t");
scanf("%d",&a);
printf("Enter Second Number: \t");
scanf("%d",&b);
printf("Enter Third Number: \t");
scanf("%d",&c);
printf("\n");
biggestNumber(a,b,c);
printf("\n");
smallestNumber(a,b,c);
return 0;
}
biggestNumber(int a,int b ,int c){
if(a>b && a>c)
printf("%d is the biggest number of the 3\n",a);
else if(b>a && b>c)
printf("%d is the biggest number of the 3\n",b);
else
printf("%d is the biggest number of the 3\n",c);
}
smallestNumber(int a,int b ,int c){
if(a<b && a<c)
printf("%d is the smallest number of the 3\n",a);
else if(b<a && b<c)
printf("%d is the smallest number of the 3\n",b);
else
printf("%d is the smallest number of the 3\n",c);
}
OUTPUT :
| C - Biggest and Smallest of 3 numbers |