Последнее задание выдаёт ошибку. Хотя я вывел все 3 минимальный значения на экран в чём ЗАГВО́ЗДКА?
package com.javarush.task.task02.task0217;
/*
Минимум четырех чисел
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
int result ;
min(a, b);
if (d < c)
result = d;
else result = c;
return result;
}
public static int min(int a, int b ) {
int result ;
if (a < b)
result = a;
else
result = b;
return result;//напишите тут ваш код
}
public static void main(String[] args) throws Exception {
System.out.println(min(-20, -10));
System.out.println(min(-20, -10, -30, -40));
System.out.println(min(-20, -10, -30, 40));
}
}package com.javarush.task.task02.task0217;
/*
Минимум четырех чисел
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
int result ;
min(a, b);
if (d < c)
result = d;
else result = c;
return result;
}
public static int min(int a, int b ) {
int result ;
if (a < b)
result = a;
else
result = b;
return result;//напишите тут ваш код
}
public static void main(String[] args) throws Exception {
System.out.println(min(-20, -10));
System.out.println(min(-20, -10, -30, -40));
System.out.println(min(-20, -10, -30, 40));
}
}
Даже если я дополню код сравнения между переменной а и б он всёравно скажет , что код задачи не выполнен. Там в условии System.out.println(min(-20, -10, -30, -40)); то есть вывод именно -40. я ему говорю -40 меньше -30 он отвечает да и выводит -40, а дальше код как понимаю завершается и условие if повторяется?