#include<iostream.h> #include<conio.h> #include<stdlib.h> void main() { system ("cls"); int a[3][3],b[3][3],i,j; cout<<"\n\tEnter the element of a matrix"; for(i=0;i<3;i++) for(j=0;j<3;j++) cin>>a[i][j]; cout<<"\n\tGiven matrix is:"; for(i=0;i<3;i++) { cout<<"\n"; for(j=0;j<3;j++) cout<<a[i][j]<<" "; } cout<<"\n\tTranspose of a given matrix is:"; for(i=0;i<3;i++) { cout<<"\n"; for(j=0;j<3;j++) { b[i][j]=a[i][j]; cout<<b[i][j]<<" "; } } getch(); }
Learn C++ Programming fast and easy, find C++ Program Codes