Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

greatest of three in java

import java.util.*;
class Main 
{
     public static void main(String[] aa){
         Scanner sc=new Scanner(System.in);
         int n1,n2,n3;
         n1=sc.nextInt();
         n2=sc.nextInt();
         n3=sc.nextInt();
         System.out.println(n1>n2 ?(n1>n3?n1:n3): (n2>n3 ? n2 : n3));
    
}
}
 
PREVIOUS NEXT
Tagged: #greatest #java
ADD COMMENT
Topic
Name
4+8 =