From 50c379c090b50f1e7b848c158b90775c315e3b03 Mon Sep 17 00:00:00 2001 From: psc2uwxgy Date: Fri, 22 Nov 2024 13:22:08 +0800 Subject: [PATCH] ADD file via upload --- 2nd.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 2nd.cpp diff --git a/2nd.cpp b/2nd.cpp new file mode 100644 index 0000000..6185939 --- /dev/null +++ b/2nd.cpp @@ -0,0 +1,27 @@ +#include +int main(){ + float num[3][4]; + for(int i=0;i<3;i++){ + for(int j=0;j<4;j++){ + scanf("%f",&num[i][j]); + } + } + for(int i=0;i<3;i++){ + float sum=0; + for(int j=0;j<=3;j++){ + if(j==0){ + printf("%.0f ",num[i][j]); + }else{ + printf("%.1f ",num[i][j]); + if(j>=1){ + sum+=num[i][j]; + } + if(j==3){ + printf("%.1f \n",sum); + sum=0; + } + } + } + } + return 0; +}