-
Notifications
You must be signed in to change notification settings - Fork 14
/
13.c
35 lines (34 loc) · 800 Bytes
/
13.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
#include<stdio.h>
int main()
{
int row, column;
printf("Enter row and column of matrix: ");
scanf("%d %d", &row, &column);
int matrix[row][column];
int i, j;
for ( i = 0; i < row; i++ )
{
for ( j = 0; j < column; j++ )
{
printf("Enter row %d and column %d of matrix: ", i+1, j+1);
scanf("%d", &matrix[i][j]);
}
}
int transpose_matrix[column][row];
for ( i = 0; i < row; i++ )
{
for ( j = 0; j < column; j++ )
{
transpose_matrix[j][i] = matrix[i][j];
}
}
printf("Transpose matrix: \n");
for ( i = 0; i < column; i++ )
{
for ( j = 0; j < row; j++ )
{
printf("%d ", transpose_matrix[i][j]);
}
printf("\n");
}
}