#include<stdio.h>
#include<conio.h>
int main()
{
int a[4][4],c,r;
for(r=1;r<4;r++)
{
for(c=1;c<4;c++)
{
printf("Enter %d Row adn %d column: ",r,c);
scanf("%d",&a[r][c]);
}// inner loop clossed
} // outer loop clossed
printf("Before Transpose\n\n");
for(r=1;r<4;r++)
{
for(c=1;c<4;c++)
{
printf("%d",a[r][c]);
printf("\t");
} // inner loop clossed
printf("\n");
} // outer loop clossed
printf("\n\nAfter Transpose\n\n");
for(r=1;r<4;r++)
{
for(c=1;c<4;c++)
{
printf("%d",a[c][r]);
printf("\t");
} // inner loop clossed
printf("\n");
} // outer loop clossed
getch();
}
#include<conio.h>
int main()
{
int a[4][4],c,r;
for(r=1;r<4;r++)
{
for(c=1;c<4;c++)
{
printf("Enter %d Row adn %d column: ",r,c);
scanf("%d",&a[r][c]);
}// inner loop clossed
} // outer loop clossed
printf("Before Transpose\n\n");
for(r=1;r<4;r++)
{
for(c=1;c<4;c++)
{
printf("%d",a[r][c]);
printf("\t");
} // inner loop clossed
printf("\n");
} // outer loop clossed
printf("\n\nAfter Transpose\n\n");
for(r=1;r<4;r++)
{
for(c=1;c<4;c++)
{
printf("%d",a[c][r]);
printf("\t");
} // inner loop clossed
printf("\n");
} // outer loop clossed
getch();
}
Output
Before transpose:
2 3 4
1 8 0
3 6 9
After transpose:
2 1 3
3 8 6
4 0 9