import java.util.Scanner;
public class Sta {             //创建类Sta
public static void main(String[] args) {
int i;          //定义变量
        int score[]=new int[5];
Scanner sc=new Scanner(System.in);       //通过循环,从键盘输入5位同学的成绩
        for(i=0;i<5;i++){
        System.out.println("请输入第"+(i+1)+"学生的成绩:");
        score[i]=sc.nextInt();
        }
        for(i=0;i<5;i++){           //通过循环,输出5位同学的成绩
        System.out.println("请输入第"+(i+1)+"学生的成绩:"+score[i]);
        }
}

}

学生成绩录入

知识点:for循环语句

相关文章:

  • 2021-08-02
  • 2021-08-27
  • 2021-10-05
  • 2022-12-23
  • 2021-07-16
  • 2021-09-08
  • 2021-07-15
  • 2021-09-27
猜你喜欢
  • 2021-06-13
  • 2022-01-21
  • 2021-06-04
  • 2022-12-23
  • 2021-12-15
相关资源
相似解决方案