2014-09-13 · 知道合伙人软件行家
关注
展开全部
public class Test {
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static String getString(){
try {
return br.readLine();
} catch (IOException e) {
return "";
}
}
public static int getInt(){
return Integer.parseInt(getString());
}
public static void main(String[] args){
int[] s = new int[5];
for(int i=0; i<s.length; i++){
System.out.print("请输入第 " + (i+1) + " 个数: ");
s[i] = getInt();
}
int min = s[0];
int max = s[0];
for(int i=1; i<s.length; i++){
if(s[i] > max){
max = s[i];
}
if(s[i] < min){
min = s[i];
}
}
System.out.println("最大是: " + max);
System.out.println("最小是: " + min);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询