View Code of Problem 51

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



return 0;
}

Double click to view unformatted code.


Back to problem 51