Richa wants to draw a flowchart to find smallest of the four given numbers. Is it advisable to directly make the flowchart or should she make something else before drawing the flowchart.
Answers
Answered by
3
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 = 0; i < 4; i++){
System.out.print("Enter number " + (i+1) + ":");
int num = sc.nextInt();
list.add(num);
};
int min = Collections.min(list);
System.out.println("The minimum of the 4 numbers is " + min);
}
}
Explanation:
Similar questions