-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
executable file
·43 lines (43 loc) · 930 Bytes
/
test.c
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
42
43
#include <stdio.h>
int main()
{
int num[10][10], row, col, i, j;
int tran[10][10];
printf("Enter the row and column of the matrix : ");
scanf("%d %d ", &row, &col);
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
printf("num[%d][%d]= ", i, j);
scanf("%d", &num[i][j]);
}
printf("\n");
}
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
tran[j][i] = num[i][j];
}
}
printf("The actual matrix is \n");
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
printf("%d ", num[i][j]);
}
printf("\n");
}
printf("\n The transpose of the matrix is \n");
for (i = 0; i < col; i++)
{
for (j = 0; j < row; j++)
{
printf("%d ", tran[i][j]);
}
printf("\n");
}
return 0;
}