Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<stdio.h>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- long n, m, sum = 0;
- cout << "Введите кол-во строк и столбцов";
- cin >> n >> m;
- long** arr = new long* [n+1];
- for (long i = 0; i <= n; i++)
- arr[i] = new long[m+1];
- cout << "Введите элементы матрицы: ";
- for (long i = 1; i <= n; i++)
- for (long j = 1; j <= m; j++){
- cin >> arr[i][j];
- if (i % 2 == 0){
- sum += arr[i][j];
- }
- }
- cout << "Сумма: " << sum << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement