-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSTRANS.C
More file actions
52 lines (45 loc) · 851 Bytes
/
PSTRANS.C
File metadata and controls
52 lines (45 loc) · 851 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
45
46
47
48
49
50
51
52
//TITLE: WAP to Create TRANSPOSE OF MATRIX
#include <stdio.h>
#include <conio.h>
void main()
{
int i,j,a[3][3],b[3][3];
clrscr();
printf("\nADD DATA TO MATRIX A :\n");
for (i=0;i<3;i++)
{
for (j=0;j<3;j++)
{
printf("Enter element for a[%d][%d]=",i,j);
scanf("%d",&a[i][j]);
}
}
printf("\n MATRIX A : \n");
for (i=0;i<3;i++)
{
for (j=0;j<3;j++)
{
printf("%3d\t",a[i][j]);
}
printf("\n");
}
//CREATING TRANSPOSE
for (i=0;i<3;i++)
{
for (j=0;j<3;j++)
{
b[j][i]=a[i][j];
}
printf("\n");
}
printf("TRANSPOSE MATRIX : \n");
for (i=0;i<3;i++)
{
for (j=0;j<3;j++)
{
printf("%3d",b[i][j]);
}
printf("\n");
}
getch();
}