Laitofai

72

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