public class Solution {
public static int min(int a, int b) {
//在此编写你的代码
int c =a , d=b ;
int m;
if (c<d)
{ m=c;
}
else
{
m=d;
int min = m;
System.out.println(m);}
return m;
}
}
public static void main(String[] args) throws Exception {
System.out.println(min(12, 33));
System.out.println(min(-20, 0));
System.out.println(min(-10, -20));
}
}
package zh.codegym.task.task02.task0214;
/*
两个数字中的最小值
*/
public class Solution {
public static int min(int a, int b) {
//在此编写你的代码
int c =a , d=b ;
int m;
if (c<d)
{ m=c;
}
else
{
m=d;
int min = m;
System.out.println(m);}
return m;
}
}
public static void main(String[] args) throws Exception {
System.out.println(min(12, 33));
System.out.println(min(-20, 0));
System.out.println(min(-10, -20));
}
}