Wednesday, July 20, 2011

Program to find transpos of a matrix

/*Serial No.93     [swami68.cpp]*/

#include<stdio.h>
#include<conio.h>
void main()
{
int mat1[10][10];
int i,j,r,c;
clrscr();
printf("enter the no of rows=");
scanf("%d",&r);
printf("enter the no of column=");
scanf("%d",&c);
printf("enter the Ist matrix\n");
for(i=0;i<r;i++)
    {
    for(j=0;j<c;j++)
        {
        scanf("%d",&mat1[i][j]);
        }
    }
printf("\n\n\nFirst Entered matrix is:\n");
for(i=0;i<r;i++)
    {
    printf("\n");
    for(j=0;j<c;j++)
        {
        printf("\t%d",mat1[i][j]);
        }
    }
printf("\n\nTranspose of matrix is:\n");
for(i=0;i<c;i++)
    {
    printf("\n");
    for(j=0;j<r;j++)
        {
        printf("\t%d",mat1[j][i]);
        }
    }
getch();
}

No comments:

Post a Comment

If you have any doubt, feel free to ask...