Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
811 B
1
Indexable
Never
import java.util.Scanner;
public class Main {
 public static void main(String[] args) {
 double[] inputNums = input();
 double productOfMinAndMax = findMinNum(inputNums) * 
findMaxNum(inputNums);
 System.out.println(productOfMinAndMax);
 }
 public static double[] input() {
 Scanner scan = new Scanner(System.in);
 double[] inputArray = new double[4];
 for(int i = 0; i < inputArray.length; i++) {
 inputArray[i] = scan.nextDouble();
 }
 return inputArray;
 }
 public static double findMaxNum(double[] d) {
 double max = d[0];
 for(int i = 1; i < d.length; i++) {
 if(max < d[i]) {
 max = d[i];
 }
 }
 return max;
 }
 public static double findMinNum(double[] d) {
 double min = d[0];
 for(int i = 1; i < d.length; i++) {
 if(min > d[i]) {
 min = d[i];
 }
 }
 return min;
 }
}
Leave a Comment