Menu

Display Minimum of Three Numbers: Java Program

import java.util.*;
class Display_min_3{
public static void main(String args[]){

Scanner sc= new Scanner(System.in);
System.out.println("please enter three numbers");
int n1= sc.nextInt();
int n2= sc.nextInt();
int n3=sc.nextInt();

int min = n1<n2  ? (n1<n3) ? n1:n3 : (n2<n3) ? n2:n3;
System.out.println("The smallest number is " +min);


}}