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
1 Réponse
+ 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");
}