Source code:
/*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.
Ex. A^T = -A*/
#include<stdio.h>
void tranpose();
void getmatrix();
int check();
int m, n, rows, columns;
int matrix[3][3], transpose[3][3];
void tranpose()
{
for(rows = 0 ; rows < m ; rows++)
{
for(columns = 0; columns < n; columns++)
{
transpose[columns][rows] = matrix[rows][columns];
}
}
}
void getmatrix()
{
printf("Enter a matrix:\n");
for(rows = 0; rows < m; rows++)
{
for(columns = 0; columns < n; columns++)
{
scanf("%d", &matrix[rows][columns]);
}
}
}
int check()
{
if(m == n)
{
for(rows = 0; rows < m; rows++)
{
for(columns = 0; columns < m; columns++)
{
if(matrix[rows][columns] != -transpose[rows][columns])
{
break;
}
}
if(columns != m)
{
break;
}
}
if(rows == m)
{
return 0;
}
}
else
{
return 1;
}
}
int main()
{
int x;
printf("Enter the number of row:");
scanf("%d", &m); /*Enter the Number of Rows: */
printf("Enter the number of column:");
scanf("%d", &n); /*Enter the Number of Columns: */
getmatrix(); /*Get the Elements of the Square Matrix from input case */
tranpose(); /*Function to perform transpose of the matrix */
x = check(); /*To check if the matrix is a skewed symmetric matrix */
if(x == 0)
{
printf("The Entered Matrix is A Skewed Symmetric Matrix\n");
}
else
{
printf("The Entered Matrix is Not A Skewed Symmetric Matrix\n");
}
return 0;
}
Output: