google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: PROGRAM TO PRINT LOWER TRIANGULAR MATRIX

Saturday, February 6, 2016

PROGRAM TO PRINT LOWER TRIANGULAR MATRIX

//PROGRAM TO PRINT LOWER TRIANGULAR MATRIX
#include<stdio.h>

void main()
{
int m,n,i,j,a[10][10];

printf("Enter the order of a square matrix: ");
scanf("%d%d",&m,&n);
if(m==n)
{
printf("Enter %d elements in the matrix:\n",m*n);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
printf("You have entered the following matrix:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf("%4d",a[i][j]);
printf("\n");
}
printf("Lower triangular matrix for the given matrix is:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(i<j)
a[i][j]=0;
printf("%4d",a[i][j]);
}
printf("\n");
}
}
else
printf("Matrix should be a square matrix,So enter a valid order");

}

हिम्मत

 अंधेरे में एक करोड का हीरा गिर गया था, उसे ढूंढने के लिए पाँच रूपएं की मोमबत्ती ने सहयोग किया। अभी बताओ वह पाँच रूपएं की एक छोटी सी मोमबत्त...