Venciity

[SoftUni Java] Syntax - 04.TheSmallestOf3Numbers

May 12th, 2014
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;
  3.  
  4.  
  5. public class TheSmallestOf3Numbers {
  6.  
  7.     public static void main(String[] args)
  8.     {
  9.         DecimalFormat format = new DecimalFormat();
  10.             format.setDecimalSeparatorAlwaysShown(false);
  11.        
  12.         Scanner input = new Scanner(System.in);
  13.         double a = input.nextDouble();
  14.         double b = input.nextDouble();
  15.         double c = input.nextDouble();
  16.        
  17.        
  18.         if (a < b)
  19.         {
  20.             if (a < c)
  21.             {
  22.                 System.out.println(format.format(a));
  23.             }
  24.             else
  25.             {
  26.                 System.out.println(format.format(c));
  27.             }
  28.         }
  29.         else
  30.         {
  31.             if (b < c)
  32.             {
  33.                 System.out.println(format.format(b));
  34.             }
  35.             else
  36.             {
  37.                 System.out.println(c);
  38.             }
  39.         }
  40.        
  41.         input.close();
  42.     }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment