Ads Top

Transpose of a matrix program using c

Transpose of  a matrix ,program, using c,lab,practicals,computer

Determinant of a matrix program

#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],i,j,m,n,b[10][10];

clrscr();
printf("Enter the  rows and columns of matrix A: ");
scanf("%d%d",&m,&n);
printf("Enter the  matrix: ");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf(%d",&a[i][j]);
}
printf("The given matrix is :\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
printf("transpose of a matrix :\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
b[i][j]=a[i][j];
printf(" %d\t",b[i][j]);
}
printf("\n");
}
getch();
}


Output

Enter the rows and columns of matrix A :2  2

Enter the matrix:1  2   3   4The given matrix is :
1     2     
3     4

Transpose of given matrix is:
1     3 
2     4

No comments:

Touchfeeds. Powered by Blogger.