1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package
本章总结;
import
java.util.Scanner;
public
class
A03 {
public
static
void
main(String[] args) {
int
count =
0
;
double
num =
0
, sum =
0
;
Scanner in =
new
Scanner(System.in);
for
(
int
i =
0
; i <
3
; i++) {
System.out.println(
"第"
+ (i +
1
) +
"班的成绩:"
);
for
(
int
j =
0
; j <
4
; j++) {
System.out.println(
"请输入第"
+ (j +
1
) +
"位学员的成绩:"
);
num = in.nextDouble();
if
(num >=
85
) {
sum += num;
count++;
}
}
}
System.out.println(
"总"
+ sum / count);
}
}
|
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1426328