Advertisement
STANAANDREY

sb prog 9

Feb 23rd, 2022
840
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int n;
  6.     cin >> n;
  7.     int a[n][n];
  8.     int currNr = 2;
  9.     for (int i = 0; i < n; i++) {
  10.         for (int j = 0; j < n; j++) {
  11.             a[i][j] = currNr;
  12.             currNr += 2;
  13.         }
  14.     }
  15.  
  16.     for (int i = 0; i < n; i++) {
  17.         for (int j = 0; j < n; j++) {
  18.             cout << a[i][j] << ' ';
  19.         }
  20.         cout << endl;
  21.     }
  22.  
  23.     return 0;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement