//Write the c program to calculate the sum of element of lower triangle of //nXn matrix
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],r,c;
int i=0,j=0,sum=0;
clrscr();
printf("\n enter the r and c");
scanf("%d%d",&r,&c);
printf("\n enter the array\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\n enter the array\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("\t%d",a[i][j]);
}
printf("\n");
}
printf("\n sum of lower triangle\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
if(i>=j)
sum=sum+a[i][j];
}
}
printf("\n sum of lower tringle=%d",sum);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],r,c;
int i=0,j=0,sum=0;
clrscr();
printf("\n enter the r and c");
scanf("%d%d",&r,&c);
printf("\n enter the array\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\n enter the array\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("\t%d",a[i][j]);
}
printf("\n");
}
printf("\n sum of lower triangle\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
if(i>=j)
sum=sum+a[i][j];
}
}
printf("\n sum of lower tringle=%d",sum);
getch();
}