Answers for "Symmetrical matrix in C"

C
0

Symmetrical matrix in C

#include "stdio.h"
int main()
{
    int n,m,arr[100][100];
    printf("order of the matrix:");
    scanf("%d",&n);
    printf("Enter the valuesn");
    for(int j=0;j<n;j++)
    {
        for(int i=0;i<n;i++)
        {
            printf("%dx%d=",i+1,j+1);
            scanf("%d",&arr[i][j]);
        }
    }
        printf("Given Matrixn");

    for(int j=0;j<n;j++)
    {
        for(int i=0;i<n;i++)
        {
            printf("%dt",arr[i][j]);
        }
        printf("n");
    }
    int k,q=0;
    for(int j=0;j<n;j++)
    {
        for(int i=0;i<n;i++)
        {
            if(arr[i][j]!=arr[j][i])
            {
                q++;
            }
        }
    
    }
    if(q==0)
    {
        printf("Symmetrical");
    }
    else
        printf("Not Symmetrical");

}
Posted by: Guest on February-07-2022

Code answers related to "C"

Browse Popular Code Answers by Language