package com.codegym.task.task02.task0217;
/*
Minimum of four numbers
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
//
int m;
if (f <= c && a <= d) {
m = f;
}
else if (c <= f && c <= d) {
m = c;
}
else {
m = d;
} public static int min(int a, int b) {
//
int f;
if (a <= b) {
f = a;
} else {
f = b;
}
return m;
}
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(-40, -10, -30, 40));
}
}
package com.codegym.task.task02.task0217;
/*
Minimum of four numbers
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
//
int m;
if (f <= c && a <= d) {
m = f;
}
else if (c <= f && c <= d) {
m = c;
}
else {
m = d;
} public static int min(int a, int b) {
//
int f;
if (a <= b) {
f = a;
} else {
f = b;
}
return m;
}
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(-40, -10, -30, 40));
}
}