c program to print upper and lower triangle of a matrix,check upper triangular matrix in c,lower triangular matrix in c,triangular matrix in c without using arrays,sum of upper triangular matrix in c,what is upper triangular matrix,triangular matrix in c language,c program for sum of diagonal elements in matrix,
C program that find the sum of upper triangular elements of matrix.
#include"stdio.h"
int main()
{
int a[20][20],i,j,m,n,sum =
0;
printf(“Enter the size of
matrix”);
scanf(“%d%d”,&m,&n);
printf("Enter the %d
elements of matrix: ",m*n);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
printf("\nSetting zero in upper
triangular matrix\n");
for(i=0;i<m;i++){
for(j=0;j<n;j++)
if(i>=j)
sum += a[i][j];
}
printf(“Sum = %d”,sum);
return 0;
}