You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
890 B

#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;
}