Skip to content

Instantly share code, notes, and snippets.

@abouolia
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abouolia/c40e5b4aa8b942a36db0 to your computer and use it in GitHub Desktop.
Save abouolia/c40e5b4aa8b942a36db0 to your computer and use it in GitHub Desktop.
Transport the matrix 4*2
#include<stdio.h>
#include<string.h>
//Created By Ahmed Bouhuolia
main(){
int n, m, i, j, matrix[256][256], transport[256][256];
printf("Enter the number of rows and columns of the matrix ");
scanf("%d %d", &n, &m);
printf("Enter the elements of the matrix %d*%d ", n, m);
for( i = 0; i < n; i++ ){
for( j = 0; j < m; j++){
scanf("%d", &matrix[i][j]);
}
}
printf("Your matrix is \n");
for( i = 0; i < n; i++ ){
for( j = 0; j< m; j++ ){
printf("%d \t", matrix[i][j]);
}
printf("\n");
}
printf("T\n");
for( i = 0; i < n; i++ ){
for( j = 0; j < m; j++){
transport[j][i] = matrix[i][j];
}
}
printf("The matrix after Transport \n");
for( i = 0; i < m; i++ ){
for( j = 0; j < n; j++){
printf("%d \t", transport[i][j] );
}
printf("\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment