HW3.8-LMLPHP

 import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);

         System.out.print("Please enter n1: ");
         int n1 = input.nextInt();
         System.out.print("Please enter n2: ");
         int n2 = input.nextInt();
         System.out.print("Please enter n3: ");
         int n3 = input.nextInt();

         input.close();

         if(n1 <= n2 && n1 <= n3)
         {
             if(n2 >= n3)
             {
                 int temp = n3;
                 n3 = n2;
                 n2 = temp;
             }
         }
         if(n2 <= n1 && n2 <= n3)
         {
             int temp = n2;
             n2 = n1;
             n1 = temp;
             if(n3 <= n2)
             {
                 int anotherTemp = n3;
                 n3 = n2;
                 n2 = anotherTemp;
             }
         }
         if(n3 <= n1 && n3 <= n2)
         {
             int temp = n1;
             n1 = n3;
             n3 = temp;
             if(n3 <= n2)
             {
                 int anotherTemp = n2;
                 n2 = n3;
                 n3 = anotherTemp;
             }
         }

         System.out.println("n1 = " + n1);
         System.out.println("n2 = " + n2);
         System.out.println("n3 = " + n3);
     }
 }
05-08 14:56