Java
- 2 ответа
- 0 вопросов
1
Вклад в тег
public class minFinder {
public static void main(String[] args) {
float[] array = {-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,10,9,8,7,6,5,4,3,2,1};
float minVal = array[0];
for (int i = 1; i < array.length; i++) {
if(array[i] < minVal & array[i] < 0) minVal = array[i];
}
System.out.println(minVal < 0?"Min in array is " + minVal:"Min in array has not found");
}
}