-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path1HM6.CPP
More file actions
27 lines (27 loc) · 492 Bytes
/
1HM6.CPP
File metadata and controls
27 lines (27 loc) · 492 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Program to do transpose of a matrix.
#include<stdio.h>
#include<conio.h>
main()
{
int a[4][4], b[4][4], i,j,m,n;
clrscr();
printf("Enter The Order Of Matrix (a*b):\n");
scanf("%d %d",&m,&n);
printf("\nEnter Elements Of Matrix:\n");
for (i=1;i<=m;i++)
for (j=1;j<=n;j++)
scanf("%d",&a[i][j]);
for (i=1;i<=m;i++)
for (j=1;j<=n;j++)
b[i][j]=a[j][i];
printf("\nTranspose Of Obtained Matrix Is:\n");
for (i=1;i<=m;i++)
{
for (j=1;j<=n;j++)
{
printf("%d\t",b[i][j]);
}
printf("\n");
}
getch();
}