My idea was this:
int index = -1
int min = arr[0];
for (int i = 0; i < arr.length; i++){
if (arr[i] < min){
min = arr[i];
index = i;
}
}
The problem is if for example there are two or more numbers with the same value... How do I have to change my code to get ALL numbers?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire