-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path13.c
More file actions
44 lines (37 loc) · 842 Bytes
/
Copy path13.c
File metadata and controls
44 lines (37 loc) · 842 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
42
43
44
#include <stdio.h>
int main()
{
int i, j, row, col;
printf("Enter Row & Columns Size: ");
scanf("%d %d", &row, &col);
int matrix[row][col];
printf("Enter Matrix Elements:\n");
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
scanf("%d", &matrix[i][j]);
}
}
printf("Entered Matrix:\n");
for (i = 0; i < row; i++)
{
printf("\t|");
for (j = 0; j < col; j++)
{
printf("%4d", matrix[i][j]);
}
printf(" |\n");
}
printf("Matrix Transposed:\n");
for (i = 0; i < col; i++)
{
printf("\t|");
for (j = 0; j < row; j++)
{
printf("%4d", matrix[j][i]);
}
printf(" |\n");
}
return 0;
}