标签:can 个人 style people class for 成绩 bsp 输入
/*程序袁欢,袁欢的博客,www.g-7.net,革启博客 版本:vs2019社区版 功能:计算学生个人平均成绩*/ #include<stdio.h> int main() { int i, j;//循环变量 int score[4][3]; int aver_people[4] = { 0 }; printf("请输入成绩:\n"); for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { scanf_s("%d", &score[i][j]); } } printf("每个人的成绩如下:\n"); for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { printf("%-4d", score[i][j]); } printf("\n"); } //计算各人成绩 for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { aver_people[i] = aver_people[i] + score[i][j]; } aver_people[i] = aver_people[i] / 3; } printf("平均成绩为:\n"); printf("王伟:%d;王强:%d;袁欢:%d;罗梅:%d\n",aver_people[0], aver_people[1], aver_people[2], aver_people[3]); return 0; }
标签:can 个人 style people class for 成绩 bsp 输入
原文地址:https://www.cnblogs.com/qq1480040000/p/13360037.html