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) {
//write your code here
int e = min( a, b);
if((a<=b) && (a<=c) && (a<=d))
{
return a;
}
if((b<=a) && (b<=c) && (b<=d))
{
return b;
}
if((c<=a) && (c<=b) && (c<=d))
{
return c;
}
if((d<=a) && (d<=b) && (d<=c))
{
return d;
}
return 0;
}
public static int min(int a, int b) {
//write your code here
if((a<=b))
{
return a;
}
else {
return b;
}
return e;
}
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) {
//write your code here
int e = min( a, b);
if((a<=b) && (a<=c) && (a<=d))
{
return a;
}
if((b<=a) && (b<=c) && (b<=d))
{
return b;
}
if((c<=a) && (c<=b) && (c<=d))
{
return c;
}
if((d<=a) && (d<=b) && (d<=c))
{
return d;
}
return 0;
}
public static int min(int a, int b) {
//write your code here
if((a<=b))
{
return a;
}
else {
return b;
}
return e;
}
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));
}
}