#include <stdio.h> int main () { int m , n ; printf ( "Enter the number of rows and columns of the matrix: " ); scanf ( " %d %d " , & m , & n ); int matrix [ m ][ n ]; // Original matrix int transpose [ n ][ m ]; // Transposed matrix printf ( "Enter the elements of the matrix: \n " ); for ( int i = 0 ; i < m ; i ++ ){ for ( int j = 0 ; j < n ; j ++ ){ printf ( "Enter element [ %d ][ %d ]: " , i , j ); scanf ( " %d " , & matrix [ i ][ j ]); } } // Print the original matrix printf ( " \n Original Matrix: \n " ); for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { ...
Comments
Post a Comment