100% c prog to print transpose of a matrix
#include <stdio.h>
void main()
{
int i,j,m,n,a[20][20],b[20][20];
printf("\n this program will take a matrix as input and print its transpose\n");
printf("\n enter no of rows&columns each in 1 to 20:");
scanf("%d%d",&m,&n);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("\n enter a[%d][%d]:",i,j);
scanf("%d",&a[i][j]);
b[j][i]=a[i][j];
}
}
printf("\n given matrix is:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
printf("%5d",a[i][j]);
}
printf("\n");
}
printf("\n transpose of the given matrix is:\n");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
printf("%5d",b[i][j]);
}
printf("\n");
}
}// end of main()
ఔట్పుట్ తెరమీద
this program will take a matrix as input and print its transpose
enter no of rows&columns each in 1 to 20:2
3
enter a[0][0]:1
enter a[0][1]:2
enter a[0][2]:3
enter a[1][0]:10
enter a[1][1]:20
enter a[1][2]:0
given matrix is:
1 2 3
10 20 0
transpose of the given matrix is:
1 10
2 20
3 0
enter no of rows&columns each in 1 to 20:2
3
enter a[0][0]:1
enter a[0][1]:2
enter a[0][2]:3
enter a[1][0]:10
enter a[1][1]:20
enter a[1][2]:0
given matrix is:
1 2 3
10 20 0
transpose of the given matrix is:
1 10
2 20
3 0
మరోసారి చేస్తే ఔట్పుట్ తెరమీద
this program will take a matrix as input and print its transpose
enter no of rows&columns each in 1 to 20:2 2
enter a[0][0]:1
enter a[0][1]:9enter no of rows&columns each in 1 to 20:2 2
enter a[0][0]:1
enter a[1][0]:4
enter a[1][1]:7
given matrix is:
1 9
4 7
transpose of the given matrix is:
1 4
9 7
//దేశభక్తులు ఇక్కడ 1947ని గుర్తిస్తారు
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.