Advertisement
velio84

_04_TheSmallestOfThreeNumbers

Sep 8th, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. package Homework2;
  2. import java.util.*;
  3.  
  4. public class TheSmallestOfThreeNumbers {
  5.  
  6.     public static void main(String[] args) {
  7.  
  8.         Scanner sc = new Scanner(System.in);
  9.  
  10.         System.out.println("Enter a, b, c:");
  11.  
  12.         double a = sc.nextDouble();
  13.         double b = sc.nextDouble();
  14.         double c = sc.nextDouble();
  15.        
  16.         double min = a;
  17.  
  18.         if (b <= min) {
  19.             min = b;
  20.         }
  21.         if (c <= min) {
  22.             min = c;
  23.         }
  24.         System.out.print("The smallest number is " +  min);
  25.  
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement