So I need some help and maybe you guys can check my code and see why it isn't working and what I'm missing.
Here is the code:
import java.util.Scanner;
public class min;
public static void main(string[] args) {
Scanner input = new Scanner(System.in);
double[] list = new double[4];
double min = list[0];
System.out.print("Enter " + list.length + " numbers: ");
for (int i = 0; i < list.length; i++) {
list[i] = input.nextDouble();
if (list[i] < min) {
min = list[i];
}
}
System.out.println(min);
}
}
So, why does it bring back 0.0 when I have the greater than facing min?
When I flip the sign around it works and brings back the greatest number, when I put out a list of numbers it works both min and max, just not for minimum input.