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.

33 lines
710 B

#include <stdio.h>
#define SIZE 3
struct student
{
int id;
float score_math;
float score_phi;
float score_eng;
float sum;
};
void input(struct student a[]){
for(int i = 0; i<3;i++){
scanf("%d",&a[i].id);
scanf("%f",&a[i].score_math);
scanf("%f",&a[i].score_phi);
scanf("%f",&a[i].score_eng);
a[i].sum = a[i].score_math + a[i].score_phi + a[i].score_eng;
}
for(int j = 0;j < 3;j++){
printf("%d %.1f %.1f %.1f %.1f\n",a[j].id,a[j].score_math,a[j].score_phi,a[j].score_eng,a[j].sum);
}
return;
}
int main(){
struct student studentgrade[3];
input(studentgrade);
return 0;
}