import java.util.Scanner;
public class Test18 {
public static void main(String[] args){
Scanner s=new Scanner(System.in);
int min=Integer.MAX_VALUE;
int max=Integer.MIN_VALUE;
System.out.print("请输入一个整数(0结束):");
int value=s.nextInt();
while(value!=0){
if(value
if(value>max)
max=value;
System.out.print("请输入一个整数(0结束):");
value=s.nextInt();
}
System.out.println("min:"+min+",max:"+max);
}
}
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class $ {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Listdata = new ArrayList<>();
while (true) {
System.out.print("请输入一个整数(输入0结束)");
int a = in.nextInt();
if (a == 0) {
break;
}
data.add(a);
}
System.out.println("最大值:" + Collections.max(data));
System.out.println("最小值:" + Collections.min(data));
}
}
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int a=0;
System.out.println("请输入一个整数(输入0结束):");
a=input.nextInt();
int max=a;
int min=a;
while(a!=0){
System.out.println("请输入一个整数(输入0结束):");
a=input.nextInt();
if(a==0){
break;
}
else if(a>max&&a>min){
max=a;
}
else if(a
}
}
System.out.println("最大"+max);
System.out.println("z最小"+min);