greatest of three in java

Solutions on MaxInterview for greatest of three in java by the best coders in the world

showing results for - "greatest of three in java"
Antoine
18 Jan 2018
1import java.util.*;
2class Main 
3{
4     public static void main(String[] aa){
5         Scanner sc=new Scanner(System.in);
6         int n1,n2,n3;
7         n1=sc.nextInt();
8         n2=sc.nextInt();
9         n3=sc.nextInt();
10         System.out.println(n1>n2 ?(n1>n3?n1:n3): (n2>n3 ? n2 : n3));
11    
12}
13}