# c program using if function !!!!!!

This is a discussion on c program using if function !!!!!! within the C Programming forums, part of the General Programming Boards category; which is the shortest method to write a program to print 3 numbers in increasing order using if-else....... suppose we ...

1. ## c program using if function !!!!!!

which is the shortest method to write a program to print 3 numbers in increasing order using if-else.......

suppose we enter 4 5 6 and the output is 6 > 5 > 4 ;

2. That's nice homework - why not try it yourself first?

3. i tried so much but i can't . no need of full program but if u tell me some simple trick , use of operators , etc !!!!!!!!!!

4. Oh come on - surely you can write it for two numbers, even if the number of 'if' statements used isn't the minimum.

What happens if we give you a 1-line piece of magic, then your tutor asks you to explain it to the rest of the class?

5. but program takes 2 or 3 pages......and it takes 9 something conditions... can u execute all condition in 2 or 3 steps

6. There are only 6 possible outcomes - how can you possibly have 2 pages of code.

Consider
if ( a > b && a > c )
How many permutations of b and c are left to resolve?

7. Test Cases; input to check program works right.
1 2 3
3 2 1
1 3 2
2 1 3
2 3 1
3 1 2
2 2 2
2 2 3
2 2 1
1 2 2
3 2 2
0 0 0

Tim S.

8. yes 6 possibilities. it goes 2 pages coz of paper size
my tutor ask me to solve this but i thnk its the shortest way to solve it

Hey do u know name of a windows bug which used as a useful program in windows now a days

9. and more if we took 2 or 3 no. equal like stahta01 statement !

I m newbie in c so any other way to solve it only with looping , switch case ,