LoraOrliGeo

Task5

Aug 23rd, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package main.java.lesson2;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Task5 {
  6. public static void main(String[] args) {
  7.  
  8. Scanner sc = new Scanner(System.in);
  9.  
  10. System.out.println("Insert three numbers:");
  11. int a = sc.nextInt();
  12. int b = sc.nextInt();
  13. int c = sc.nextInt();
  14.  
  15. if (a < b && a < c){
  16. if (b < c){
  17. System.out.println(c + " " + b + " " + a);
  18. } else {
  19. System.out.println(b + " " + c + " " + a);
  20. }
  21. } else if (b < a && b < c){
  22. if (a < c){
  23. System.out.println(c + " " + a + " " + b);
  24. } else {
  25. System.out.println(a + " " + c + " " + b);
  26. }
  27. } else if (c < a && c < b){
  28. if (a < b) {
  29. System.out.println(b + " " + a + " " + c);
  30. } else {
  31. System.out.println(a + " " + b + " " + c);
  32. }
  33. } else {
  34. System.out.println("The three numbers are equal!");
  35. }
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment