From c0a94bf5590a9a4d27fa0a8d727e0cd1bca75ef7 Mon Sep 17 00:00:00 2001 From: p5fohke9s <837368911@qq.com> Date: Wed, 20 Nov 2024 17:01:57 +0800 Subject: [PATCH] ADD file via upload --- b2.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 b2.c diff --git a/b2.c b/b2.c new file mode 100644 index 0000000..ec6943e --- /dev/null +++ b/b2.c @@ -0,0 +1,36 @@ +#include +int main() +{ + struct Students + { + int num; + float score1; + float score2; + float score3; + float sum; + }students[3]; + int i; + for (i = 0; i < 3; i++) + { + scanf("%d", &students[i].num); + scanf("%f", &students[i].score1); + scanf("%f", &students[i].score2); + scanf("%f", &students[i].score3); + students[i].sum= students[i].score1 + students[i].score2 + students[i].score3; + } + for (i = 0; i < 3; i++) + { + printf("%d %.1f %.1f %.1f %.1f\n", + students[i].num, + students[i].score1, + students[i].score2, + students[i].score3, + students[i].sum); + } + + return 0; + +} + + +