Created
October 28, 2024 18:22
-
-
Save vlaleli/36b4f9380236bd42c29b35f38c8b60d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| int main() | |
| { | |
| int n; | |
| cout << "Enter size: "; | |
| cin >> n; | |
| int matrix[30][30]; | |
| for (int i = 0; i < n; i++) | |
| { | |
| for (int j = 0; j < n; j++) | |
| { | |
| if (i == n / 2 || j == n / 2) | |
| { | |
| matrix[i][j] = 1; | |
| } | |
| else | |
| { | |
| matrix[i][j] = 0; | |
| } | |
| } | |
| } | |
| for (int i = 0; i < n; ++i) | |
| { | |
| for (int j = 0; j < n; ++j) | |
| { | |
| cout << matrix[i][j] << " "; | |
| } | |
| cout << endl; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment