Guy i need your help i have been stuck here for a day | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guy i need your help i have been stuck here for a day

When i input -6 -20 -3. The output is -6 -3 -20. Which is wrong. I want the answer as -3 -6 -20. https://code.sololearn.com/c3IBiCqT011P/?ref=app

30th May 2020, 9:14 PM
stephen haokip
stephen haokip - avatar
1 Answer
+ 1
This works: //a b c if(a >= b && a >= c && b >= c){ System.out.println(a + " " + b + " " + c); //a c b }else if(a >= b && a >= c && c >= b){ System.out.println(a + " " + c + " " + b); //b a c }else if(b >= a && b >= c && a >= c){ System.out.println(b + " " + a + " " + c); //b c a }else if(b >= a && b >= c && c >= a){ System.out.println(b + " " + c + " " + a); //c a b }else if(c >= a && c >= b && a >= b){ System.out.println(c + " " + a + " " + b); //c b a }else if(c >= a && c >=b && b >= a){ System.out.println(c + " " + b + " " + a); }else{ System.out.println("Error"); }
30th May 2020, 11:14 PM
Denise Roßberg
Denise Roßberg - avatar