Laitofai

73

Apr 8th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. //73
  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 == 0 || i == n - 1 || j == 0 || j == n - 1){
  14.                 arr[i][j] = 1;
  15.             }else{
  16.                 arr[i][j] = 0;
  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