Answer to Question #269395 in Java | JSP | JSF for Elena

Question #269395

Use java method to find minimum among entered five numbers


1
Expert's answer
2021-11-20T14:20:22-0500
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;


public class App {


	/**
	 * The start point of the program
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner keyBoard = new Scanner(System.in);
		List<Integer> intValues = new ArrayList<>();
		for (int i = 0; i < 5; i++) {
			System.out.print("Enter number " + (i + 1) + ": ");
			intValues.add(keyBoard.nextInt());
		}
		Integer min = Collections.min(intValues);
		System.out.println("Minimum number: " + min);
		keyBoard.close();
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS