answersLogoWhite

0

Sorry to delete the previous version of this program, but this one is much more concise and sophisticated. I have written this program for a 3*3 matrix, but if you want to change it, just enter additional variables to store the order of the matrix and then replace the "3"s of the program with them as needed. It's easy. So here we go:

#include

#include

void swap(int *x,int *y);

main()

{

int i,j,k,m,n;

int matrix[3][3];

printf("Enter the matrix: \n\n");

for (i=0;i<3;++i)

{

printf("\nEnter #%d row: ",(i+1));

for (j=0;j<3;++j)

scanf("%d",&matrix[i][j]);

}

printf("\n\n");

for (j=0;j<3;++j)

{

for (i=0;i<3;++i)

if (i>j)

swap(&matrix[i][j],&matrix[j][i]);

}

printf("The transposed matrix is: \n\n");

for (i=0;i<3;++i)

{

for (j=0;j<3;++j)

printf("%4d",matrix[i][j]);

printf("\n\n");

}

}

void swap(int *x,int *y)

{

int t=*x;

*x=*y;

*y=t;

return;

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

How do you write a java program to find the transpose of the matrix for the given elements?

You basically write a nested for loop (one for within another one), to copy the elements of the matrix to a new matrix.


Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix?

Sp[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Answer]]ell chec[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix&amp;action=edit&amp;section=new|Answer it!]]k your answe[[Q/Discuss:Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Disc]][[help/answering questions|guidelin]]Spell check your answeresussionr[[help/signing in|full benefits]] Save C[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 ]][[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix&amp;action=edit&amp;section=new|Answering 'Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix?']]matrix?ancel[[Q/How many animals are in West Texas|How many animals are in West Texas?]][[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a]][[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a Service workshop?]] Service workshop?[[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a Service workshop?]]More Q&amp;A


How do you write c program to perform sum of elements of matrix using pointers with functions?

i cant write


Write a program to multiply 33 matrix.?

write a program to multily 3*3 matrix.


2x2 matrix multiplication program in 8085 processor?

how to write a program for matrix multiplication in microprocesspr


How do you Write A program in c language for checking a diagonal matrix?

Write a program in c++ that take input in a integer matrix of size 4*4 and find out if the entered matrix is diagonal or not.


A c program to square matrix?

A C program to square matrix is a math problem. In the math problem you write down all the outer boundary values of matrix in a circle, then write down the inner value.


Write a c program to find eigenvalue of a matrix?

Yes, do write. That's what you always have to do when you have got a homework-program.


Write a program to print the sum of a sparse matrix?

This is a directive, not a question.


Write a c program for matrix addition using function?

#include&lt;


Write a C program to find sum of 3 matrices?

matrix


How do you write a java program to find the ad joint of a matrix?

bgfygfrhjyuyhh