forked from kushalsingh-00/C-Programs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
matrix4.c
40 lines (37 loc) · 829 Bytes
/
matrix4.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
/*
-------------------------------------------------------
Name : Matrix
Author : Kushal Singh Rathore
Discription : Printing Transpose Of A Matrix
-------------------------------------------------------
*/
#include<stdio.h>
int main()
{
int a[100][100],b,c,transpose[100][100];
printf("Enter the no of rows and column\n");
scanf("%d %d",&b,&c);
printf("Enter the elements\n");
for(int i=0;i<b;i++)
{
for (int j = 0; j < c; j++)
{
scanf("%d",&a[i][j]);
}
}
for(int i=0;i<b;i++)
{
for (int j = 0; j < c; j++)
{
transpose[j][i]=a[i][j];
}
}
for(int i=0;i<c;i++)
{
for (int j = 0; j < b; j++)
{
printf("%d ",transpose[i][j]);
}
printf("\n");
}
}