C Program to find the biggest and smallest of three numbers
by Nideesh C on April 18, 2011 · 0 comments
in C Programming
The entered three numbers N1, N2, N3 are compared in such an order, where the first comparison checks if N1 largest. If so, prints it out and exists; if not so, it omits N1 from further comparison and checks with N2 and N3 only. The same logic but with complement operator, the program finds the least among the three.
#include<stdio.h>
void main()
{
int n1, n2, n3;
clrscr();
printf(“nnt ENTER THREE NUMBERS A,B,C…(separated by commas): “);
scanf(“%d,%d,%d”, &n1, &n2, &n3);
printf(“nnt THE BIGGEST NUMBER IS…: “);
if( (n1 > n2) && (n1 > n3) )
printf(“%d”, n1);
else if(n2 > n3)
printf(“%d”, n2);
else
printf(“%d”, n3);
printf(“nnt THE SMALlEST NMBER IS…: “);
if( (n1 < n2) && (n1 < n3) )
printf(“%d”, n1);
else if(n2 < n3)
printf(“%d”, n2);
else
printf(“%d”,n3);
getch();
}
Not Satisfied ? Just search & get the result
Related posts:
- C Program To find the biggest and smallest number and positions in the given array
- C program to find the biggest of three numbers
- C Program To find the fibonacci numbers below a given number.
- C Program to find the prime numbers between a given range
- C Program to find the prime numbers below a given number.
Tagged as:
C program to find the biggest and smallest of three numbers,
to find the biggest and smallest of three numbers
Me, freelance system administrator having the qualification of Diploma in Electronics & Tele-communication + MCSE + CCNA + CST + 5 years of experience in IT field.
If you like This post, you can follow TheOnlineTutorials on Twitter.
Contact me Via email: support@theonlinetutorials.com
Subscribe to feed via Feed or EMAIL to receive instant updates.
Legal Disclaimer:All information found on the site is without any implied warranty of fitness for any purpose or use whatsoever. Content author/site administrator is not responsible for any loss occurred due to mistakes in this tutorial. Use this tutorial website at your own risk.