#include<stdio.h> #define max 1000; int main(){ int n; int a[max][max],b[max][max]; 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); return 0; } /* Main.c: In function 'main': Main.c:2:17: error: expected ']' before ';' token #define max 1000; ^ Main.c:5:9: note: in expansion of macro 'max' int a[max][max],b[max][max]; ^~~ Main.c:5:17: error: expected statement before ']' token int a[max][max],b[max][max]; ^ Main.c:5:18: error: expected expression before ',' token int a[max][max],b[max][max]; ^ Main.c:5:19: error: 'b' undeclared (first use in this function) int a[max][max],b[max][max]; ^ Main.c:5:19: note: each undeclared identifier is reported only once for each function it appears in Main.c:2:17: error: expected ']' before ';' token #define max 1000; ^ Main.c:5:26: note: in expansion of macro 'max' int a[max][max],b[max][max]; ^~~ Main.c:5:18: warning: left-hand operand of comma expression has no effect [-Wunused-value] int a[max][max],b[max][max]; ^ Main.c:11:17: error: 'a' undeclared (first use in this function) scanf("%d",&a[j][i]); ^ */ |
Double click to view unformatted code.