google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: Write the c program to calculate the sum of element of lower triangle of nXn matrix

Saturday, February 6, 2016

Write the c program to calculate the sum of element of lower triangle of nXn matrix

//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();
}

शिव भोलेनाथ स्तुति

 जय शिवशंकर, जय गंगाधर, करुणा-कर करतार हरे,   जय कैलाशी, जय अविनाशी, सुखराशि, सुख-सार हरे जय शशि-शेखर, जय डमरू-धर जय-जय प्रेमागार हरे,   जय ...