From 9ca477effaf25c0c3a7592263c8f43058dd06d55 Mon Sep 17 00:00:00 2001 From: p72fupixj Date: Sun, 5 Nov 2023 15:18:55 +0800 Subject: [PATCH] ADD file via upload --- 2.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 2.c diff --git a/2.c b/2.c new file mode 100644 index 0000000..c9c5b1c --- /dev/null +++ b/2.c @@ -0,0 +1,25 @@ +#include + +struct stu_info +{ + int num; + float math,physics,english,total; +} stu[3]; + +int main() +{ + int i; + for(i=0;i<3;i++) + { + scanf("%d",&stu[i].num); + scanf("%f",&stu[i].math); + scanf("%f",&stu[i].physics); + scanf("%f",&stu[i].english); + stu[i].total=stu[i].math+stu[i].physics+stu[i].english; + } + for(i=0;i<3;i++) + { + printf("%d %.1f %.1f %.1f\n",stu[i].num,stu[i].math,stu[i].physics,stu[i].english,stu[i].total); + } + return 0; +}