作者:孤独丶Angle_251 | 来源:互联网 | 2023-10-16 17:58
import java.util.Scanner;
public class Java11 {public static void main(String[] args) {int num = 0;Scanner input = new Scanner(System.in);System.out.println("请输入一个整数输入0结束");num = input.nextInt();int max = num;int min = num;while (num != 0){if (num > max) {max = num;}else if (num < min){min = num;}System.out.println("请输入一个整数输入0结束");num = input.nextInt();}System.out.println("最大值是:"+ max + "最小值是:" +min);}
}