fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. int a,b;
  6. scanf("%d %d",&a,&b);
  7. int arr[a][b];
  8.  
  9. for(int i=0; i<a; i++){
  10. for(int j=0; j<b; j++){
  11. scanf("%d",&arr[i][j]);
  12. }
  13. }
  14. for(int j=0; j<b; j++){
  15. int sum=0;
  16. for(int i=0; i<a; i++){
  17. sum=sum+arr[i][j];
  18. }
  19. printf("the sum of colume %d is %d\n",i,sum);
  20.  
  21. }
  22.  
  23. return 0;
  24. }
  25.  
Compilation error #stdin compilation error #stdout 0.01s 5304KB
stdin
2 2
3 3
5 5
compilation info
prog.c: In function ‘main’:
prog.c:19:40: error: ‘i’ undeclared (first use in this function)
  printf("the sum of colume %d is %d\n",i,sum);
                                        ^
prog.c:19:40: note: each undeclared identifier is reported only once for each function it appears in
prog.c:6:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&a,&b);
  ^~~~~~~~~~~~~~~~~~~~
prog.c:11:4: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&arr[i][j]);
    ^~~~~~~~~~~~~~~~~~~~~~
stdout
Standard output is empty