Q:

Java Program to find the smallest number among three numbers

0

Program to find the smallest number among three numbers by taking user input

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.Scanner;
public class demo1 
{
 public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        System.out.print("Input the first number: ");
        double a = input.nextDouble();
        System.out.print("Input the Second number: ");
        double b = input.nextDouble();
        System.out.print("Input the third number: ");
        double c = input.nextDouble();
        System.out.print("The smallest value is " + smallest(a, b, c)+"\n" );
    }
   public static double smallest(double a, double b, double c)
    {
        return Math.min(Math.min(a, b), c);
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now