pages

Sunday, 8 August 2021

program to find transpose of the matrix in c-programming language | c-tutorial

Transpose of the matrix 

This C program is to find transpose of a matrix.

The new matrix obtained by interchanging the rows and columns of the original 
matrix is called as the transpose of the matrix. If A = [aij] be an m × n matrix,
 then the matrix obtained by interchanging the rows and columns of A would be the 
transpose of A. of It is denoted by A′or (AT).  

]

#include<stdio.h>
#include<conio.h>
void main()
{
    int a[3][3],i,j;
    printf("enter the value of the matrix:-");
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    printf("\n****************\n");
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
        {
            printf("%3d",a[i][j]);
        }
        printf("\n");
    }
    printf("\n the transpose of the matrix is :-\n");
    for(i=0;i<3;i++)
    {
        for(j=0;j<3;j++)
        {
            printf("%3d",a[j][i]);
        }
        printf("\n");
    }
    getch();
}


output:-






No comments:

Post a Comment