Ask Question
14 July, 20:21

Write a program to find the transpose of a 5x5 matrix. You have toask the user to enter the values for input matrix. Transpose isobtained by interchanging the rows and columns of the input matrix. Aij - -> Aji. For example, if A is

1 4 6

2 9 5

6 3 6

+5
Answers (1)
  1. 14 July, 21:15
    0
    C+ + program for finding transpose of matrix

    #include

    using namespace std;

    //driver function

    int main ()

    {

    int matrix[5][5], transpomat[5][5], r, c;

    //Taking row number as input from user and storing in r

    cout<<"Enter the number of row: ";

    cin>>r;

    //Taking column number as input from user and storing in c

    cout<<"Enter the number of column: ";

    cin>>c;

    / * Taking elements of matrix as input from user

    */

    cout<<"Enter elements: "<
    for (int a = 0; a
    for (int b=0; b
    cin>>matrix[a][b];

    }

    }

    / / Loop for finding transpose matrix

    for (int a=0; a
    for (int b=0; b
    transpomat[b][a] = matrix[a][b];

    }

    }

    //Printing the transpose matrix

    cout<<"Transpose of Matrix: "<
    for (int a=0; a
    for (int b=0; b
    cout<
    / * Formatting output as a matrix

    */

    if (b==r-1)

    cout<
    }

    }

    return 0;

    }

    Output

    Enter the number of row:3

    Enter the number of column:3

    Enter elements:

    1 4 6

    2 9 5

    6 3 6

    Transpose of Matrix:

    1 2 6

    4 9 3

    6 5 6
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a program to find the transpose of a 5x5 matrix. You have toask the user to enter the values for input matrix. Transpose isobtained ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers