forked from coding-technology/JavaCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest12.java
More file actions
28 lines (23 loc) · 927 Bytes
/
Test12.java
File metadata and controls
28 lines (23 loc) · 927 Bytes
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
26
27
28
import java.util.Scanner;
public class Test12 {
public static void main(String[] args) {
//3个班级,各个班有4个同学。求每个班的平均分。
for (int j = 0; j < 3; j++) {
System.out.println("j:" + j + "外-------");
// System.out.println("请输入第"+(j+1)+"个班的成绩");
//一个班: 每个人的平均
// 一个班: 每个人的平均
//一重:4个同学,计算平均分
Scanner input = new Scanner(System.in);
int sum = 0;
int score = 0;
for (int i = 0; i < 4; i++) {
System.out.println("i:" + i + "内******");
// System.out.println("请输入第"+(i+1)+"个学生的成绩");
// score = input.nextInt() ;
// sum += score ;
}
System.out.println(sum / 4.0);
}
}
}