Advertisement
ruhul0

Transpose Matrix

Aug 15th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int i,j,k,row=3,column=4,a[100][100],b[100],count=0;
  6.     for(i=0;i<row;i++)
  7.     {
  8.         for(j=0;j<column;j++)
  9.               cin>>a[i][j];
  10.               b[count]=a[i][--j];
  11.               count++;      
  12.     }
  13.     cout<<"\n";
  14.     for(i=0;i<row;i++)
  15.     {
  16.         for(j=0;j<column-1;j++)
  17.              cout<<a[i][j]<<" ";
  18.         cout<<"\n";
  19.     }
  20.     for(i=0;i<count;i++)
  21.     {
  22.         cout<<b[i]<<" ";
  23.     }
  24.     getchar();
  25.     getchar();
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement