···
package com.company;
import java.util.Scanner;
public class demo29 {
public static void main(String[] args) {
System.out.println("输入学生的姓名:");
Scanner scanner =new Scanner(System.in);
String name = scanner.next();
int sum =0;
int score =0;
for (int i=0;i<5;i++){
System.out.println("这是5门课中的第"+i+"门课的成绩:");
score = scanner.nextInt();
sum +=score;
}
System.out.println("平均分:"+sum/5);
}
}
···