#include<stdio.h> void main(){ int n; int a[][],b[][]; int sum=0; scanf("%d",&n); for(int j=0;j<n;j++){ for(int i=0;i<n;i++) { scanf("%d",&a[j][i]); } } for(int j=0,m=n-1;j<n;j++,m--){ for(int i=0,l=n-1;i<n;i++,l--) { b[i][j]=a[m][l]; } } for(int i=0;i<n;i++) { for(int j=1;j<n;j++) sum+=b[i][j]; n--; } printf("%d",sum); } /* Main.c:2:6: warning: return type of 'main' is not 'int' [-Wmain] void main(){ ^~~~ Main.c: In function 'main': Main.c:4:7: error: array type has incomplete element type 'int[]' int a[][],b[][]; ^ Main.c:4:7: note: declaration of 'a' as multidimensional array must have bounds for all dimensions except the first Main.c:4:13: error: array type has incomplete element type 'int[]' int a[][],b[][]; ^ Main.c:4:13: note: declaration of 'b' as multidimensional array must have bounds for all dimensions except the first Main.c:4:13: warning: unused variable 'b' [-Wunused-variable] Main.c:4:7: warning: unused variable 'a' [-Wunused-variable] int a[][],b[][]; ^ */ |
Double click to view unformatted code.