C Programming
C Programming

Transpose of a Matrix

Transpose Of a Matrix

computer

Transpose Of a Matrix

 

Question:

Write a program to take input of a Matrix and then print the Transpose of that Matrix

Solution:

 

#include<stdio.h>
int main(){
    int m,n;
    printf(“Enter the number of rows:”);
    scanf(“%d”,&m);
    printf(“Enter the number of columns:”);
    scanf(“%d”,&n);
    int arr[m][n];
    int brr[n][m];
    for(int a=0;a<m;a++){
        for(int b=0;b<n;b++){
            printf(“Enter the (%d,%d) element\n”,a+1,b+1);
            scanf(“%d”,&arr[a][b]);
        }
    }
    printf(“The Matrix entered by you.\n”);
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            printf(“%d “,arr[i][j]);
        }
        printf(“\n”);
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
           brr[j][i]= arr[i][j];
        }
    }
    printf(“The transpose of matrix is:\n”);
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            printf(“%d “,brr[i][j]);
        }
        printf(“\n”);
    }
    return 0;
}

Topics Covered :

  • transpose matrix in c
  • how to print transpose of a matrix in c
  • print transpose matrix in c
  • transpose matrix program in c
  • transpose matrix program
  • program on matrix in c
  • print transpose matrix using 2d array in c
  • c program to print transpose matrix
  • 2d array program in c
  • 2d array example in c
  • two dimensional arrays program in c
  • c programming tutorials for beginners
  • gate cs lectures
  • operating system
  • learn coding

 

 


 

Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.

Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.

 

🧑‍💻🧑‍💻 Social Media Links of Tech DCode :

👉🏻 YouTube : https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
👉🏻 Instagram : https://www.instagram.com/thetechdcode/
👉🏻 Facebook Page : https://www.facebook.com/thetechdcode
👉🏻 Twitter : https://twitter.com/thetechdcode
👉🏻 Telegram Channel : https://t.me/thetechdcode
👉🏻 Tech DCode Linktree : https://linktr.ee/thetechdcode
👉🏻 My Personal Handles : https://linktr.ee/virtualshivamin

🧑‍💻🧑‍💻 Social Media Links of SHIVAM SINGH (OWNER) :

👉🏻 Instagram : https://www.instagram.com/virtualshivamin/
👉🏻 Facebook Page : https://www.facebook.com/virtualshivamin/
👉🏻 Twitter : https://twitter.com/virtualshivamin/
👉🏻 Personal Linktree : https://linktr.ee/virtualshivamin 

 

Leave a Reply

Your email address will not be published. Required fields are marked *