Advertisement
AmidamaruZXC

TaskH

Apr 24th, 2021
639
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     int** matr;
  10.     matr = new int* [n];
  11.     for (int i = 0; i < n; i++)
  12.     {
  13.         matr[i] = new int[n];
  14.         for (int j = 0; j < n; j++)
  15.         {
  16.             cin >> matr[i][j];
  17.             if (j >= i)
  18.                 matr[i][j] = 1;
  19.         }
  20.     }
  21.     for (int i = 0; i < n; i++)
  22.     {
  23.         for (int j = 0; j < n; j++)
  24.             cout << matr[i][j] << " ";
  25.         cout << endl;
  26.     }
  27. }
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement