draw a flowchart to find largest of n number
Answers
Answered by
0
Answer:
import java.util.*;
class HelloWorld {
public static void main(String[] args) {
System.out.print("Enter the count of numbers:");
ArrayList<Integer> list = new ArrayList<Integer>();
Scanner scanner = new Scanner(System.in);
int size = scanner.nextInt();
for(int i = 0; i < size; i++)
{
System.out.print("Enter the number " + (i+1) + ":");
int z = scanner.nextInt();
list.add(z);
}
int max = Collections.max(list);
System.out.println("The largest of " + size + " numbers is "+ max);
}
}
Explanation: output -
Attachments:
Similar questions