#include <stdio.h>
#define MAX 1000

void le_matriz(double M[][MAX], int n, int m){
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            scanf("%lf", &M[i][j]);
        }
    }
    
}

void imprime_matriz(double M[][MAX], int n, int m){
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            printf("%.2lf ", M[i][j]);
        }
        printf("\n");
    }
}

void calcula_transposta(double M[][MAX], double T[][MAX], int n, int m){
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
                T[i][j] = M[j][i];
        }
    }    
}

int main() {
    int n, m;
    double A[MAX][MAX], T[MAX][MAX];
    scanf("%d %d", &n, &m);
    
    le_matriz(A, n, m);
    calcula_transposta(A, T, n, m);
    imprime_matriz(T, n, m);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: