public static void main(String[] args) {
int[] yuan = {1,3,56,78,100,99};
int maxNum = 0;
for(int i=0; i<yuan.length-1; i++){
maxNum = Math.max(yuan[i], yuan[i+1]);
}
}
获取数组中的最大值,求最大值
最新推荐文章于 2023-10-24 16:17:17 发布
public static void main(String[] args) {
int[] yuan = {1,3,56,78,100,99};
int maxNum = 0;
for(int i=0; i<yuan.length-1; i++){
maxNum = Math.max(yuan[i], yuan[i+1]);
}
}