Transpose Matrix program – C + +

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])

{
int a[10][10],m,n,i,j;
cout<<“Masukkan Jumlah Baris: “;
cin>>m;
cout<<“Masukkan Jumlah kolom: “;
cin>>n;
cout<<endl<<“Elemen matriks: “<<endl;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<“masukkan elemen a: “<<i+1<<j+1<<“: “;
cin>>a[i][j];
}
}
cout<<endl<<“Matriks: “<<endl<<endl;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<a[i][j]<<” “;
}
cout<<endl<<endl;
}
cout<<endl<<“Transpose Matriks: “<<endl<<endl;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<a[j][i]<<” “;
}
cout<<endl<<endl;
}
system(“PAUSE”);
return EXIT_SUCCESS;

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s