C program to Input Data and Transpose it.
Matrix be [5][5]
#include<stdio.h>
#include<conio.h>
void main( )
{
int arr[i][j], i , j ;
clrscr( );
for( i=0; i<5; i=i+1 )
{
for( j=0; j<5; j=j+1 )
{
printf("Enter Data ");
scanf("%d",& arr[i][j] );
}
printf("\n");
}
for( j=0; j<5; j=j+1 )
{
for( i=0; i<5; i=i+1 )
{
printf("%d\n", arr[i][j] );
}
printf("\n");
}
getch( );
}
Run Program
Matrix be [5][5]
Enter Data 1
Enter Data 2
Enter Data 3
Enter Data 4
Enter Data 5
Enter Data 6
Enter Data 7
Enter Data 8
Enter Data 9
Enter Data 10
Enter Data 11
Enter Data 12
Enter Data 13
Enter Data 14
Enter Data 15
Enter Data 16
Enter Data 17
Enter Data 18
Enter Data 19
Enter Data 20
Enter Data 21
Enter Data 22
Enter Data 23
Enter Data 24
Enter Data 25
Output
1
6
11
16
21
2
7
12
17
22
3
8
13
18
23
4
9
14
19
24
5
10
15
20
25
Matrix be [5][5]
#include<stdio.h>
#include<conio.h>
void main( )
{
int arr[i][j], i , j ;
clrscr( );
for( i=0; i<5; i=i+1 )
{
for( j=0; j<5; j=j+1 )
{
printf("Enter Data ");
scanf("%d",& arr[i][j] );
}
printf("\n");
}
for( j=0; j<5; j=j+1 )
{
for( i=0; i<5; i=i+1 )
{
printf("%d\n", arr[i][j] );
}
printf("\n");
}
getch( );
}
Run Program
Matrix be [5][5]
Enter Data 1
Enter Data 2
Enter Data 3
Enter Data 4
Enter Data 5
Enter Data 6
Enter Data 7
Enter Data 8
Enter Data 9
Enter Data 10
Enter Data 11
Enter Data 12
Enter Data 13
Enter Data 14
Enter Data 15
Enter Data 16
Enter Data 17
Enter Data 18
Enter Data 19
Enter Data 20
Enter Data 21
Enter Data 22
Enter Data 23
Enter Data 24
Enter Data 25
Output
1
6
11
16
21
2
7
12
17
22
3
8
13
18
23
4
9
14
19
24
5
10
15
20
25
0 Comments