Advertisement
marius7122

Untitled

Jul 11th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int mat[100][100], n, m, i, j, inv;
  6.  
  7. int main ()
  8. {
  9.     cout<<"n= "; cin>>n;
  10.  
  11.     cout<<"m= "; cin>>m;
  12.  
  13.     for(i = 0; i < n; i++)
  14.     {
  15.         for(j = 0; j < m; j++)
  16.         {
  17.             cout<<"mat["<<i<<"]["<<j<<"]= "; cin>>mat[i][j];
  18.         }
  19.     }
  20.  
  21.     for(i = 0; i < n; i++)
  22.     {
  23.         for(j = 0; j < m; j++)
  24.         {
  25.             inv = 0;
  26.             while(mat[i][j] > 0)
  27.             {
  28.                 inv = inv * 10 + mat[i][j] % 10;
  29.                 mat[i][j] = mat[i][j] / 10;
  30.             }
  31.  
  32.             mat[i][j] = inv;
  33.         }
  34.     }
  35.     for(i = 0; i < n; i++)
  36.     {
  37.         for(j = 0; j < m; j++)
  38.         {
  39.            cout<<mat[i][j]<<' ';
  40.         }
  41.  
  42.         cout<<endl;
  43.     }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement