View Code of Problem 51

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

Double click to view unformatted code.


Back to problem 51