Advertisement
IvanKrastev

Homework Java Syntax Problem 4 The smallest f three numbers

Jan 26th, 2015
121
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 Problem_4_TheSmallestOfThreeNumbers {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner scan= new Scanner(System.in);
  8.         System.out.print("a= ");
  9.         double a= scan.nextDouble();
  10.         System.out.print("b= ");
  11.         double b= scan.nextDouble();
  12.         System.out.print("c= ");
  13.         double c= scan.nextDouble();
  14.         double smallestNumber= Math.min(a, b);
  15.         smallestNumber= Math.min(c, smallestNumber);
  16.         System.out.printf("Smallest number of %1$f, %2$f, %3$f is %4$f", a, b, c, smallestNumber);
  17.  
  18.     }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement