View Code of Problem 51

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
	int n, a[15][15], sum = 0;
	scanf("%d", &n);
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			scanf("%d", &a[i][j]);
		}
	}
	for(int i = 0;i < n;i++){
		for(int j = 0;j <= i;j++){
			sum += a[i][j];
		}
	}
	printf("%d\n", sum);

	return 0;
}

Double click to view unformatted code.


Back to problem 51