#include <iostream>
#include <conio.h>
using namespace std;
int main(){
int n, m, A[10][10], B[10][10];
cout<<"MENCETAK MATRIKS TRANSPOSE"<<endl;
cout<<"----------------------------------"<<endl;
cout<<"Masukkan banyak baris : ";
cin>>n;
cout<<"Masukkan banyak kolom : ";
cin>>m;
cout<<endl;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cout<<"Masukkan baris ke-"<<i+1<<" kolom ke-"<<j+1<<" : ";
cin>>A[i][j];
}
}
cout<<"\nMatriks\n";
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cout<<A[i][j]<<" ";
}
cout<<endl;
}
cout<<"\nMatriks setelah ditranspose\n";
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
cout<<A[j][i]<<" ";
}
cout<<endl;
}
getch();
}
#include <conio.h>
using namespace std;
int main(){
int n, m, A[10][10], B[10][10];
cout<<"MENCETAK MATRIKS TRANSPOSE"<<endl;
cout<<"----------------------------------"<<endl;
cout<<"Masukkan banyak baris : ";
cin>>n;
cout<<"Masukkan banyak kolom : ";
cin>>m;
cout<<endl;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cout<<"Masukkan baris ke-"<<i+1<<" kolom ke-"<<j+1<<" : ";
cin>>A[i][j];
}
}
cout<<"\nMatriks\n";
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cout<<A[i][j]<<" ";
}
cout<<endl;
}
cout<<"\nMatriks setelah ditranspose\n";
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
cout<<A[j][i]<<" ";
}
cout<<endl;
}
getch();
}
Tidak ada komentar:
Posting Komentar