
wap to find largest number of list of no. entered through keyboard

Hi Friend,
Try the following code:
import java.util.*;
class FindGreatest{
public static void main(String[] args)
{
int max = Integer.MIN_VALUE;
Scanner input=new Scanner(System.in);
for(int i=1;i<=5;i++){
int num=input.nextInt();
if (num > max) {
max = num;
}
}
System.out.println("Largest Number is: "+max);
}
}
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.