diff --git a/step_2_input.c b/step_2_input.c new file mode 100644 index 0000000..8e2158c --- /dev/null +++ b/step_2_input.c @@ -0,0 +1,32 @@ +#include +#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; + +}