Advertisement
meteor4o

01. Sort Numbers

May 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. int numA = Integer.parseInt(sc.nextLine());
  8. int numB = Integer.parseInt(sc.nextLine());
  9. int numC = Integer.parseInt(sc.nextLine());
  10.  
  11. if (numA >= numB && numB >= numC) {
  12. System.out.printf("%d%n%d%n%d", numA, numB, numC);
  13. } else if (numA >= numC && numC >= numB) {
  14. System.out.printf("%d%n%d%n%d", numA, numC, numB);
  15. } else if (numB >= numA && numA >= numC) {
  16. System.out.printf("%d%n%d%n%d", numB, numA, numC);
  17. } else if (numB >= numC && numC >= numA) {
  18. System.out.printf("%d%n%d%n%d", numB, numC, numA);
  19. } else if (numC >= numB && numB >= numA) {
  20. System.out.printf("%d%n%d%n%d", numC, numB, numA);
  21. } else if (numC >= numA && numA >= numB) {
  22. System.out.printf("%d%n%d%n%d", numC, numA, numB);
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement