View Code of Problem 51

#include<stdio.h>
#include<math.h>
#include<string.h>
#define max 80
int main()
{	
	int n;
	scanf("%d",&n);
	int a[n][n];
	int sum=0;
	

	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<n;j++){
				if(i>=j){
					sum+=a[i][j];
				}
		}
	
	}
		printf("%d",sum);
	return 0;	
} 

Double click to view unformatted code.


Back to problem 51