View Code of Problem 51

#include <stdio.h>
int main()
{
        int n,sum=0;
        scanf("%d",&n);
        int arr[n+1][n+1];
        for(int i=0;i<n;++i)
        {
                for(int j=0;j<n;++j)
                {
                        scanf("%d",&arr[i][j]);
                        if(i==j||i>j)
                                sum+=arr[i][j];
                }
        }
        printf("%d",sum);

}

Double click to view unformatted code.


Back to problem 51