Add 步骤二.c

main
pvkyt5ngb 1 year ago
parent d13a5cd958
commit eff87ae214

@ -0,0 +1,25 @@
#include <stdio.h>
int main() {
int student_id[3];
float math_score[3], physics_score[3], english_score[3], total_score[3];
// Input student information
for (int i = 0; i < 3; i++) {
printf("Enter student %d's ID: ", i + 1);
scanf("%d", &student_id[i]);
printf("Enter student %d's math score: ", i + 1);
scanf("%f", &math_score[i]);
printf("Enter student %d's physics score: ", i + 1);
scanf("%f", &physics_score[i]);
printf("Enter student %d's english score: ", i + 1);
scanf("%f", &english_score[i]);
total_score[i] = math_score[i] + physics_score[i] + english_score[i];
}
// Output student information
for (int i = 0; i < 3; i++) {
printf("%d %.1f %.1f %.1f %.1f\n", student_id[i], math_score[i], physics_score[i], english_score[i], total_score[i]);
}
return 0;
}
Loading…
Cancel
Save