write a program in Java to find greatest number using max() function
Answers
Answered by
4
Explanation:import java. util.*;
class greatest{
public static void main(String []args) {
Scanner SC=new scanner(System.in) ;
System. out. printLn("enter first number ") ;
Int first_number= SC. nextInt();
System. out. println(" enter second number");
int second_number=SC.nextInt() ;
int number=Math.max(first_number, second_number) ;
System. out. printLn("the largest number is :"+number) ;
}
}
Hope it is correct. if wrong please rectify me. I am a class 9 student. THANK YOU
Similar questions