find smallest numberamong 4 number
Answers
Answered by
3
Answer:
1000 is smallest number among 4 digit
Answered by
0
Answer:
import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
ArrayList<Integer> l = new ArrayList<Integer>();
for(int i = 0; i < 4; i++)
{
System.out.print("Enter number " + (i+1) + ":");
int x = scanner.nextInt();
l.add(x);
}
int min = Collections.min(l);
System.out.println("The smallest among 4 numbers is: " + min);
}
}
Explanation:
Similar questions