Untitled

 avatar
unknown
plain_text
2 years ago
650 B
4
Indexable
#include <iostream>
using namespace std;
int main()
{
    char mas[100][100];
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (i < (n - m)/2 || i >= n - (n -m)/2 || j < (n - m) / 2 || j >= n - (n - m) / 2)
            {
                mas[i][j] = '@';
            }
            else
            {
                mas[i][j] = ' ';
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cout << " " << mas[i][j];
        }
        cout << endl;
    }
    return 0;
}
Editor is loading...
Leave a Comment