This program is about get and print the element in a two dimensional lower triangle matrix array using array and for loops.
#include<stdio.h> int main() { int a[10][10],i,j,r,c,z=0,o=0; printf("\nEnter the No of Rows:"); scanf("%d",&r); printf("\nEnter the No of Columns:"); scanf("%d",&c); printf("\nEnter the matrix Values:"); for(i=0;i<r;i++) { for(j=0;j<c;j++) { scanf("%d",&a[i][j]); } } for(i=0;i<r;i++) { for(j=0;j<c;j++) { printf("\t%d",a[i][j]); } printf("\n"); } for(i=0;i<r;i++) { for(j=0;j<c;j++) { if(i<j) { if(a[i][j]==0) { z++; } } else { o++; } } } if((r*c)==(z+o)) { printf("\n %d*%d Lower Matrix",r,c); } else { printf("\n %d*%d Not Lower Matrix",r,c); } return 0; }To download raw file Click Here
Enter the No of Rows:3 Enter the No of Columns:3 Enter the matrix Values:1 0 0 1 1 0 1 1 1 1 0 0 1 0 0 1 1 1 3*3 Lower Matrix
Learn All in Tamil © Designed & Developed By Tutor Joes