View Code of Problem 51

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


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

Double click to view unformatted code.


Back to problem 51