From 5a69983278f29ad7f8bdb49cf8e2dff89ff512a7 Mon Sep 17 00:00:00 2001 From: pvl836cjw <2745453479@qq.com> Date: Mon, 13 Nov 2023 20:32:02 +0800 Subject: [PATCH] ADD file via upload --- Task2.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Task2.c diff --git a/Task2.c b/Task2.c new file mode 100644 index 0000000..8483903 --- /dev/null +++ b/Task2.c @@ -0,0 +1,29 @@ + +#include +int main() +{ + int i; + float a[13],x,sum; + for(i=1;i<=12;i++) + { + scanf("%f",&a[i]); + } + for(i=1;i<=12;i++) + { + if(i==1||i==5||i==9) + printf("%5.0f ",a[i]); + else + { + printf("%0.1f ",a[i]); + sum+=a[i]; + if(i%4==0) + { + printf("%0.1f",sum); + printf("\n"); + sum=0; + } + + } + } +} +