From 0ac9af4b46ce5e71c62de6677d582990e000b1c1 Mon Sep 17 00:00:00 2001 From: ph9kiql5e <157842898@qq.com> Date: Sun, 5 Nov 2023 10:29:29 +0800 Subject: [PATCH] ADD file via upload --- 2.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 2.c diff --git a/2.c b/2.c new file mode 100644 index 0000000..c501e05 --- /dev/null +++ b/2.c @@ -0,0 +1,27 @@ +#include +int main() +{ + float sum(float a,float b,float c); + struct Student + { + int num; + float score1; + float score2; + float score3; + float score; + }student1,student2,student3; + scanf("%d%f%f%f",&student1.num,&student1.score1,&student1.score2,&student1.score3); + scanf("%d%f%f%f",&student2.num,&student2.score1,&student2.score2,&student2.score3); + scanf("%d%f%f%f",&student3.num,&student3.score1,&student3.score2,&student3.score3); + printf("%d %4.1f %4.1f %4.1f %4.1f\n",student1.num,student1.score1,student1.score2,student1.score3,sum(student1.score1,student1.score2,student1.score3)); + printf("%d %4.1f %4.1f %4.1f %4.1f\n",student2.num,student2.score1,student2.score2,student2.score3,sum(student2.score1,student2.score2,student2.score3)); + printf("%d %4.1f %4.1f %4.1f %4.1f\n",student3.num,student3.score1,student3.score2,student3.score3,sum(student3.score1,student3.score2,student3.score3)); + return 0; +} + +float sum(float a,float b,float c) +{ + float sum; + sum=a+b+c; + return sum; +}