Last active
August 29, 2015 14:02
-
-
Save abouolia/c40e5b4aa8b942a36db0 to your computer and use it in GitHub Desktop.
Transport the matrix 4*2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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