- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTranspose.cpp
More file actions
Latest commit
25 lines (23 loc) · 655 Bytes
/
Copy pathTranspose.cpp
File metadata and controls
25 lines (23 loc) · 655 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
#include<stdio.h>
#include<conio.h>
voidmain()
{
int i, j, rows, columns, a[10][10], b[10][10];
printf("Enter the Number of Rows & Columns of the Matrix :: ");
scanf_s("%d %d", &rows, &columns);
printf("\nEnter the Elements of the Matrix :: ");
for (i = 0;i < rows;i++) /*Accepting the Values*/
for (j = 0;j < columns;j++)
scanf_s("%d", &a[i][j]);
for (i = 0;i < columns;i++) /*Transpose*/
for (j = 0;j < rows;j++)
b[i][j] = a[j][i];
printf("\nThe Transpose of the Matrix is :: \n");
for (i = 0;i < columns;i++)
{
for (j = 0;j < rows;j++)
printf("%d\t", b[i][j]);
printf("\n");
}
_getch();
}