//基本上在這個程序中,你必須要求用戶輸入一個終止值,然後是一組數字。當你輸入終止號碼時,程序結束。然後輸出您輸入的數字的最大值和最小值,但不輸出終止值。我正在尋求幫助,因爲循環只有兩次。只有IO請。程序輸出的最大和最小值
public class smalllargest {
public static void main(String[] args) {
System.out.println("Enter any number, then re-enter that number when you wish to be done.");
int t = IO.readInt();
System.out.println("Enter your set of numbers");
int s = IO.readInt();
int max = s;
int min = s;
for(int i = 0; i!=t; i++) {
int n = IO.readInt();
if(n > max) {
max = n ;
}
if(n< max) {
min = n;
}
if(n == t){
break;
}
System.out.println("max:");
IO.outputIntAnswer(max);
System.out.println("min:");
IO.outputIntAnswer(min);
}
}
}