1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
public class 编写程序找出最低分及他在数组找中的位置 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int points[] = new int [] { 18 , 25 , 7 , 36 , 13 , 2 , 89 , 63 };
int min = points[ 0 ], index = 0 ;
for ( int i = 0 ; i < points.length; i++) {
if (min > points[i]) {
min = points[i];
index = i;
}
}
System.out.println(min + " " + (index + 1 ));
}
}
|
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1419467