This is a C program for Printing the Transpose of a Matrix.
This is a part of Mumbai University MCA College C program MCA Sem 1
Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.
Transpose of a Matrix.
#include<stdio.h>
#include<conio.h>
void main()
{
/*declarations*/
int
arr[3][3],i,j;
clrscr();
/*accept
elements for the array*/
printf("Enter
elements for the array \n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
scanf("%d",&arr[i][j]);
}
}
/*print
the original array entered by the user*/
printf("Original
array entered by the user is \n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("%d
",arr[i][j]);
}
printf("\n");
}
/*print
the transpose of the array*/
printf("transpose
of the array is \n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("%d
",arr[j][i]);
}
printf("\n");
}
getch();
}Output:
Original array entered by the user is
1 2 3
4 5 6
7 8 9
transpose of the array is
1 4 7
2 5 8
3 6 9
Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.
Download
No comments:
Post a Comment