#include<iostream.h>
#include<conio.h>
#define r 3
#define c 3
void main(){
int A[r][c],B[r][c],i,j;
clrscr();
cout<<"Enter Elements of Matrix A"<<endl;
for(i=0;i<r;i++){
for(j=0;j<c;j++){
cout<<"A["<<i<<"]"<<"["<<j<<"]=";
cin>>A[i][j];
}}
for(i=0;i<r;i++){
for(j=0;j<c;j++){
B[i][j]=A[j][i];
}}
cout<<"Transpose of Matrix A is:- "<<endl;
for(i=0;i<r;i++){
for(j=0;j<c;j++){
cout<<B[i][j]<<" ";
}
cout<<endl;
}
getch();
}
No comments:
Post a Comment