Sorting three numbers

  • 8
  • Locked
Planet Linear Chaos is populated by isomorphs. They are believed to have invented sorting algorithms. Everything in their heads is extremely well-ordered. They only issue planetary visas to people who know at least 7 sorting algorithms. Let's take our first step toward Linear Chaos: Read three numbers from the keyboard, put them in descending order, and then display them on the screen.
You can't complete this task, because you're not signed in.
Comments (41)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Elektra
Level 15 , United States of America, United States
5 January, 22:59
Something is wrong! it keeps asking me to put them in descending order while they are in descending order.
Steve C. Ands
Level 8 , Medellín, Colombia
2 December 2021, 18:07
Error?
Roman
Level 41
6 December 2021, 09:35
Show me your code, please
ron_villela
Level 9 , Miami, United States
17 July 2021, 22:43
I'm always over-thinking the solution.....I know there is probably a more efficient way of solving these however we need to stick to the lesson. So....if - else if...
Toka
Level 10 , Dugo Selo, Croatia
15 July 2021, 17:41
I solved task with IF ELSE statement only!
Usman Full Stack Developer at QA
27 June 2021, 21:19
sorted via a temporary variable here
coffeemess
Level 8 , Versailles, France
21 June 2021, 21:24
succeeded with Arrays.sort here
Omr
Level 8 , Hutton Bushel, United Kingdom
26 April 2021, 19:07
if you use Math.max and Math.min and find the medium ,you wont need to write alot of codes.
Ice_ Beam
Level 7 , Germany
17 April 2021, 16:51
This one was a bit tough, not impossible though. I recommend if you are not familiar with arrays yet, use nested if else and <= or >= .
Sinisa
Level 11 , Banja Luka, Bosnia and Herzegovina
16 February 2021, 13:23
From user input create an Integer (not int bcs it can't be reverse sorted later) array, Arrays.sort it with reverse order (import Arrays and Collections), use for loop to print the previously sorted elements, done. Wasting time with multiple IF conditions.
Davidh Dionicio
Level 17 , Lima, Peru
18 January 2021, 21:52
if (max(a,b)<max(b,c))
            System.out.println(max(b,c)+" "+max(min(b,c),a)+" "+min(min(a,b),c));
        else
            System.out.println(max(a,b)+" "+max(min(a,b),c)+" "+min(min(a,b),c));
I did it like this, tell me if this was done?