Menu

Display Maximum of Three numbers- Java Program

import java.util.*;
class Display_max_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 max = n1>n2  ? (n1>n3) ? n1:n3 : (n2>n3) ? n2:n3;
System.out.println("The largest number is " +max);

}}