Advertisement
n_stefanov

Ex4_TheSmallestOf3Nums

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