Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 76
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int arr[n][n];
- // заполняем нулями
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- arr[i][j] = 0;
- }
- }
- // заполняем по красоте
- for(int i = 0; i <= n / 2; i++){
- for(int j = i; j < n - i; j++){
- arr[j][i] = 1;
- arr[j][n - 1 - i] = 1;
- }
- }
- // выводим всё
- for(int i = 0; i < n; i++){
- for(int j = 0; j < n; j++){
- cout << arr[i][j] << " ";
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment