View Code of Problem 51

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=0;
	cin>>n;
	int a[12][12];
	for(int i=1;i<=n;++i){
		for(int m=1;m<=n;++m){
			cin>>a[i][m];
		}
	}
	for(int i=1;i<=n;++i){
		for(int m=1;m<=i;++m){
			ans+=a[i][m];
		}
	}
	cout<<ans;
	return 0;
} 

Double click to view unformatted code.


Back to problem 51