Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package _03_RevisionMoreExcercises;
- import java.util.Scanner;
- public class _01_SortNumbers {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num1 = Integer.parseInt(scanner.nextLine());
- int num2 = Integer.parseInt(scanner.nextLine());
- int num3 = Integer.parseInt(scanner.nextLine());
- if (num1 > num2 && num1 > num3){
- System.out.println(num1);
- if (num2 > num3) {
- System.out.println(num2);
- System.out.println(num3);
- } else {
- System.out.println(num3);
- System.out.println(num2);
- }
- } else if (num2 > num1 && num2 > num3) {
- System.out.println(num2);
- if (num1 > num3) {
- System.out.println(num1);
- System.out.println(num3);
- } else {
- System.out.println(num3);
- System.out.println(num1);
- }
- } else if (num3 > num1 && num3 > num2) {
- System.out.println(num3);
- if (num1 > num2) {
- System.out.println(num1);
- System.out.println(num2);
- } else {
- System.out.println(num2);
- System.out.println(num1);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement