Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int**creat(int &n, int &m)
- {
- cout << "n="; cin >> n; cout << "m="; cin >> m;
- int**mas = new int *[n];
- for (int i = 0; i < n; ++i)mas[i] = new int[m];
- for (int i = 0; i < n; ++i)
- for (int j = 0; j < m; ++j)
- {
- cout << "mas[" << i << "][" << j << "]=";
- cin >> mas[i][j];
- }
- return mas;
- }
- int main()
- {
- int n, m, k = 0;
- int s = 0;
- int **a = creat(n, m);
- for (int i = 0; i < n; i++)
- for (int j = 0; j < m; ++j)
- {
- if (i%2==0 && j%2==0)
- {
- s += i + j;
- }
- }
- if (s % 2 == 0)
- cout << "s=" << s << endl;
- for (int i = 0; i < n; i++)delete[]a[i];
- delete[]a;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment