展开全部
package l;
import java.util.Scanner;
class gt{
public static void main(String[] args) {
e68a843231313335323631343130323136353331333332643336
Scanner input = new Scanner(System.in);
int[] a = new int[5];
int max = 0, min = 0;
System.out.print("输入五个整数:");
for (int i = 0; i
a[i] = input.nextInt();
}
max = a[0];
min = a[0];
for (int i = 0; i
if (a[i] > max)
max = a[i];
if (a[i]
min = a[i];
}
System.out.println("最大的整数位:" + max);
System.out.println("最大的整数位:" + min);
}
}
以上是正确的程序,下面指出你的错误:package l;
import java.util.Scanner;
class gt {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
int[] a = new int[5];
int max = 0, min = 0;
System.out.print("输入五个整数:");
for (int i = 0; i
a[i] = input.nextInt();
}
for (int i = 0; i
if (a[i]
max = a[i + 1];
if (a[i] > a[i + 1])
max = a[i];
}
System.out.println("最大的整数位:" + max);
for (int j = 0; j
if (a[j]
min = a[j];
else
min = a[j + 1];
}
System.out.println("最大的整数位:" + min);
}
}