Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- using namespace std;
- int n;
- cout << "Enter n: " << endl;
- cin >> n;
- double** mas = new double*[n];
- for (int i = 0; i < n; i++)
- mas[i] = new double[n];
- for (int i = 0; i < n; i++)
- for (int j = 0; j < n; j++)
- mas[i][j]=0;
- double sum = 0;
- double sum2 = -mas[0][0];
- for (int i = 0; i < n; i++)
- {
- cout << endl;
- for (int j = 0; j < n; j++)
- {
- cout << mas[i][j] << " ";
- }
- }
- cout << endl;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {if (((i<=j/2)&&(j>=n/2)&&(j-i>=n/2))||((i>=n/2)&&(j>=n/2)&&(j-n+i+1>=n/2)))
- mas[j][i] = 1;
- }
- }
- for (int i = 0; i < n; i++)
- {
- cout << endl;
- for (int j = 0; j < n; j++)
- {
- cout << mas[i][j] << " ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement