-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3X3TRANS.C
47 lines (47 loc) · 872 Bytes
/
3X3TRANS.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
44
45
46
47
#include<stdio.h>
#include<conio.h>
int main()
{
int a[10][10],transpose[10][10],r,c,i,j;
clrscr();
printf("Enter rows and column of matrix:");
scanf("%d %d",&r,&c);
printf("\nEnter the element of matrix:\n");
for(i=0;i<r;++i)
{
for(j=0;j<c;++j)
{
printf("Enter the a%d%d:",i+1,j+1);
scanf("%d",&a[i][j]);
}
}
printf("\nEntered Matrix: \n");
for(i=0;i<r;++i)
{
for(j=0;j<c;++j)
{
printf("\t%d\t",a[i][j]);
if(j==c-1)
printf("\n\n");
}
}
for(i=0;i<r;++i)
{
for(j=0;j<c;++j)
{
transpose[j][i]=a[i][j];
}
}
printf("\nTranspose of Matrix:\n");
for(i=0;i<c;++i)
{
for(j=0;j<r;++j)
{
printf("\t%d\t",transpose[i][j]);
if(j==r-1)
printf("\n\n");
}
}
getch();
return 0;
}