View Code of Problem 51

#include<stdio.h>
int main()
{
  int n;
  scanf("%d\n",&n);
  int a[10][10];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      scanf("%d",&a[i][j];
  int sum;
  for(int i=0;i<n;i++)
    for(int j=n-1-i;j>=0;j--)
      sum+=a[i][j];
  printf("%d",sum);
            }
/*
Main.c: In function 'main':
Main.c:9:26: error: expected ')' before ';' token
       scanf("%d",&a[i][j];
                          ^
                          )
Main.c:14:20: error: expected ';' before '}' token
   printf("%d",sum);
                    ^
                    ;
             }
             ~       
*/

Double click to view unformatted code.


Back to problem 51