-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathU1Transpose.c
More file actions
41 lines (40 loc) · 835 Bytes
/
U1Transpose.c
File metadata and controls
41 lines (40 loc) · 835 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
#include <conio.h>
void main()
{ int a[3][3], i, j, b[3][3];
printf("\n Enter matrix elements:");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
printf("\n a[%d][%d]=", i, j);
scanf("%d", &a[i][j]);
}
}
printf("\n-----Matrix------\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
printf(" %3d", a[i][j]);
}
printf("\n");
}
printf("\n Transpose of matrix:");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
b[j][i] = a[i][j];
}
}
printf("\n-----Matrix------\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
printf(" %3d", b[i][j]);
}
printf("\n");
}
}