HW3.8

HW3.8

 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);
     }
 }
上一篇:Modbus Poll :Byte Missing Error或CRC Error


下一篇:poj 3370 Halloween treats(鸽巢原理)