WAP To Check If A Given Matrix Is Symmetric or Not
This C program defines a 2D array to represent a matrix. It prompts the user to enter the number of rows/columns, then enters values for the matrix. The program displays the original matrix, then checks if the matrix is symmetric by comparing each element to its transpose - if all pairs match, it is symmetric, otherwise it is not symmetric.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
145 views1 page
WAP To Check If A Given Matrix Is Symmetric or Not
This C program defines a 2D array to represent a matrix. It prompts the user to enter the number of rows/columns, then enters values for the matrix. The program displays the original matrix, then checks if the matrix is symmetric by comparing each element to its transpose - if all pairs match, it is symmetric, otherwise it is not symmetric.
for(i=0; i<=rc-1; i++) for(j=0; j<=rc-1; j++) { if(a[j][i] != a[i][j]) flag = 1; } if (flag == 0) printf ("The matrix is Symmetric.\n"); else printf("The matrix is Not Symmetric.\n"); }