Due on 2018-04-04, 23:59 ist a matrix whose transpose is negative to that of the original matrix, it is known as a skewed symmetric matrix. write a c program to find if the given square matrix is skew symmetric or not.
Answers
Answered by
1
C program to check if a matrix is symmetric or not: we find transpose of the matrix and then compare it with the original matrix. For a symmetric matrix AT = A.
#include<stdio.h> int main() { int m, n, c, d, matrix[10][10], transpose[10][10]; printf("Enter the number of rows and columns of matrix\n"); scanf("%d%d",&m,&n); printf("Enter elements of the matrix\n"); for ( c = 0 ; c < m ; c++ ) for ( d = 0 ; d < n ; d++ ) scanf("%d",&matrix[c][d]); for( c = 0 ; c < m ; c++ ) { for( d = 0 ; d < n ; d++ ) { transpose[d][c] = matrix[c][d]; } } if ( m == n ) /* check if order is same */ { for ( c = 0 ; c < m ; c++ ) { for ( d = 0 ; d < m ; d++ ) { if ( matrix[c][d] != transpose[c][d] ) break; } if ( d != m ) break; } if ( c == m ) printf("Symmetric matrix.\n"); } else printf("Not a symmetric matrix.\n"); return 0; }
#include<stdio.h> int main() { int m, n, c, d, matrix[10][10], transpose[10][10]; printf("Enter the number of rows and columns of matrix\n"); scanf("%d%d",&m,&n); printf("Enter elements of the matrix\n"); for ( c = 0 ; c < m ; c++ ) for ( d = 0 ; d < n ; d++ ) scanf("%d",&matrix[c][d]); for( c = 0 ; c < m ; c++ ) { for( d = 0 ; d < n ; d++ ) { transpose[d][c] = matrix[c][d]; } } if ( m == n ) /* check if order is same */ { for ( c = 0 ; c < m ; c++ ) { for ( d = 0 ; d < m ; d++ ) { if ( matrix[c][d] != transpose[c][d] ) break; } if ( d != m ) break; } if ( c == m ) printf("Symmetric matrix.\n"); } else printf("Not a symmetric matrix.\n"); return 0; }
Similar questions
Math,
8 months ago
Social Sciences,
8 months ago
India Languages,
8 months ago
Math,
1 year ago
Sociology,
1 year ago
Science,
1 year ago
Hindi,
1 year ago
English,
1 year ago