Advertisement
Guest User

The Smallest of 3 Numbers

a guest
May 12th, 2014
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class TheSmallestOne {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner sc = new Scanner(System.in);
  8.         System.out.println("Enter 3 numbers: ");
  9.         double a = Double.parseDouble(sc.next());
  10.         double b = Double.parseDouble(sc.next());
  11.         double c = Double.parseDouble(sc.next());
  12.         double minValue = Double.MIN_VALUE;
  13.         if(a <= b && a <= c)
  14.             minValue = a;
  15.         else if(b <= a && b <= c)
  16.             minValue = b;
  17.         else if(c <= b && c <= a)
  18.             minValue = c;
  19.         System.out.println(minValue);
  20.     }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement