Draw the flowchart to read 100 numbers then display the largest
Answers
Answered by
0
Answer:
import java.util.*;
public class Main
{
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<Integer>();
Scanner sc = new Scanner(System.in);
for(int i = 1; i <= 100; i++){
System.out.print("Enter number " + i + ":");
int num = sc.nextInt();
list.add(num);
}
int max = Collections.max(list);
System.out.println("The largest of the 100 numbers is " + max);
}
}
Explanation:
Similar questions