From 9693a75e0703ad3288a1dc17c7e48ba2823de788 Mon Sep 17 00:00:00 2001 From: psoyatper Date: Sun, 5 Nov 2023 09:36:58 +0800 Subject: [PATCH] ADD file via upload --- step_2_input.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 step_2_input.c 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; + +}