Skip to content

Instantly share code, notes, and snippets.

@yesidays
Created July 16, 2012 10:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yesidays/3121967 to your computer and use it in GitHub Desktop.
Save yesidays/3121967 to your computer and use it in GitHub Desktop.
Transpuesta de una matriz
#include <stdio.h>
int main() {
int m, n, c, d, matrix[10][10], trans[50][50];
printf("Ingrese el número de filas y columnas (Ejemplo: 2 5): ");
scanf("%d%d",&m,&n);
printf("Ingrese los elementos de la matriz (ejemplo 1 30): \n");
for(c=0;c<m;c++){
for(d=0;d<n;d++){
scanf("%d",&matrix[c][d]);
}
}
for(c=0;c<m;c++){
for(d=0;d<n;d++){
trans[d][c] = matrix[c][d];
}
}
printf("La transpuesta es: \n");
for(c=0;c<n;c++){
for(d=0;d<m;d++){
printf("%d\t",trans[c][d]);
}
printf("\n");
}
return 0;
}
@JosCardElectro
Copy link

goob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment