你可以使用Java的for循环来输入某同学S1结业考试的五门成绩。以下是一个示例代码:

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] scores = new int[5];
        
        for (int i = 0; i < 5; i++) {
            System.out.print('请输入第' + (i + 1) + '门成绩:');
            scores[i] = scanner.nextInt();
        }
        
        System.out.println('S1结业考试成绩:');
        for (int i = 0; i < 5; i++) {
            System.out.println('第' + (i + 1) + '门成绩:' + scores[i]);
        }
    }
}

运行上述代码后,程序会提示你输入五门成绩,然后输出这五门成绩。

Java for循环输入学生S1结业考试成绩

原文地址: https://www.cveoy.top/t/topic/gQLV 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录