Here's a program to find the biggest of 3 numbers using if...else with output and explanation in C programming language.

# include <stdio.h> # include <conio.h> void main() { int a, b, c ; clrscr() ; printf("Enter three numbers : ") ; scanf("%d %d %d", &a, &b, &c) ; if(a > b) { if(a > c) printf("\n%d is the biggest number", a) ; else printf("\n%d is the biggest number", c) ; } else { if(c > b) printf("\n%d is the biggest number", c) ; else printf("\n%d is the biggest number", b) ; } getch() ; }

**Output of above program**

Enter three numbers : 5 15 2

15 is the biggest number

**Explanation of above program**

First we ask user to enter three numbers and store them respectively in a, b, c variables. Next we have an if else condition which determines which of the three numbers is the biggest. Lets understand how it works.

- If a > b, then we check if a is also greater then c and if a > c then a is the biggest number.But if a < c in this case then c is the biggest of a, b and c.
- If a < b then else part is executed. Then we check if c > b and if it is then c is the biggest number. Otherwise b is the biggest number of three.

Tip:If you want to find the smallest number of 3 numbers simply change greater than ( > ) ti less than ( < ).

what if a == b............

i mean this thing does not work.......when i enter the integers as follows:

5

5

13

@Killed By Death: Sorry for the late reply but this code works just fine even when two or all the three numbers are same.

If you notice in the first IF we are checking for a > b so the ELSE part is dealing with a <= b.

So, in your example when a = b = 5 and c = 13, the condition a > b is false so the ELSE part is executed. Then inside ELSE, the first IF is executed as c > b (13 > 5). So the output of the program is "13 is the biggest number". Hope this explanation clears your doubt.