Advertisement
Guest User

04SmallestOfThreeNumbers

a guest
May 12th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;
  3.  
  4.  
  5. public class SmallestOfThreeNumbers {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner input = new Scanner(System.in);
  9.         double a = Double.parseDouble(input.nextLine());
  10.         double b = Double.parseDouble(input.nextLine());
  11.         double c = Double.parseDouble(input.nextLine());
  12.         double smallest = 0;
  13.         DecimalFormat format = new DecimalFormat();
  14.         format.setDecimalSeparatorAlwaysShown(false);
  15.  
  16.  
  17.         if(b<c){
  18.             smallest = Math.min(a, b);
  19.         }
  20.         else {
  21.             smallest = Math.min(a, c);
  22.         }
  23.         System.out.println( format.format(smallest));
  24.  
  25.  
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement