Computer Science, asked by harshrborse, 4 days ago

write a program in java to accept 3 integer from user and find its biggest of three by using max() and Scanner class

Answers

Answered by samarthkrv
1

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

 ArrayList<Integer> list = new ArrayList<Integer>();

     for(int i = 0; i < 3; i++){

         System.out.print("Enter number " + (i + 1) + ":");

         int x = sc.nextInt();

         list.add(x);

     }

     int max = Collections.max(list);

     System.out.println("The maximum of the 3 numbers is " + max);

}

}

Explanation:

Similar questions