View Code of Problem 51

#include<stdio.h>
#define N 10
int main(){
	int a[N][N];
	int i,j;
	int n;
	scanf("%d",&n);
	int sum=0;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
		
		scanf("%d",&a[i][j]);
	}
	}
	for(i=n-1;i>=0;i--){
		for(j=0;j<=i;j++){
			sum+=a[i][j];
		}
	}
	printf("%d\n",sum);
}

Double click to view unformatted code.


Back to problem 51