View Code of Problem 51

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int t[n][n];
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cin>>t[i][j];
		}
	}
	int sum=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++){
			sum+=t[i][j];
		} 
	}
	cout<<sum;
	return 0;
} 

Double click to view unformatted code.


Back to problem 51