-->

Facebook

Jasper Roberts - Blog

Friday, April 10, 2015

Write a function find out maximum out of three numbers.

#include<stdio.h>
#include<conio.h>

int largest()
{
int n1, n2, n3;
printf("\n ENTER THREE NUMBERS:");
scanf("%d",&n1);
printf("\n ENTER THREE NUMBERS:");
scanf("%d",&n2);
printf("\n ENTER THREE NUMBERS:");
scanf("%d",&n3);
printf("\n\n\t THE BIGGEST NUMBER IS: ");

if( (n1 > n2) && (n1 > n3) )
printf("%d", n1);
else if(n2 > n3)
printf("%d", n2);
else
printf("%d", n3);

printf("\n\n\t THE SMALlEST NMBER IS…: ");
if( (n1 < n2) && (n1 < n3) )
printf("%d", n1);
else if(n2 < n3)
printf("%d", n2);
else
printf("%d",n3);
 return 0;

}

void main()
{
clrscr();
largest();
getch();
}
Largest Numbers

No comments:

Post a Comment