Even considering the example that codegym provides, I would say this should provide the correct output.
At first it does, however when I change the input, it no longer provides the minimum.
What am I missing here?
package en.codegym.task.pro.task05.task0506;
import java.util.Scanner;
/*
Minimum of N numbers
*/
public class Solution {
public static int[] array;
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int N = keyboard.nextInt();
int [] number = new int [N];
for (int i = 0; i < N; i++){
number[i] = keyboard.nextInt();
}
int min = number[0];
for (int i = 1; i < N; i++){
if (number[i] < min){
min = number[i];
}
}
System.out.println(min);
}
}