public class Main {
public static void main(String[] args) {
int num1 = 10;
int num2 = 20;
int num3 = 15;
int max = findMax(num1, num2, num3);
System.out.println("The maximum number is: " + max);
}
public static int findMax(int a, int b, int c) {
int max = a;
if (b > max) {
max = b;
}
if (c > max) {
max = c;
}
return max;
}
}
用Java求三个数中最大值
最新推荐文章于 2024-10-17 11:21:39 发布