which is the shortest method to write a program to print 3 numbers in increasing order using if-else.......:confused:
suppose we enter 4 5 6 and the output is 6 > 5 > 4 ;
Printable View
which is the shortest method to write a program to print 3 numbers in increasing order using if-else.......:confused:
suppose we enter 4 5 6 and the output is 6 > 5 > 4 ;
That's nice homework - why not try it yourself first?
i tried so much but i can't :confused: . no need of full program but if u tell me some simple trick , use of operators , etc !!!!!!!!!!
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?
but program takes 2 or 3 pages......and it takes 9 something conditions... can u execute all condition in 2 or 3 steps
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?
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.
yes 6 possibilities. it goes 2 pages coz of paper size :D
my tutor ask me to solve this but i thnk its the shortest way to solve it :wink:
Hey do u know name of a windows bug which used as a useful program in windows now a days
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 ,