View Code of Problem 51

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


printf("%d\n",res);
	return  0;
	
} 

Double click to view unformatted code.


Back to problem 51