Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include<iostream>
  2. #include<stdio.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. setlocale(LC_ALL, "Russian");
  8. long n, m, sum = 0;
  9. cout << "Введите кол-во строк и столбцов";
  10. cin >> n >> m;
  11. long** arr = new long* [n+1];
  12. for (long i = 0; i <= n; i++)
  13. arr[i] = new long[m+1];
  14. cout << "Введите элементы матрицы: ";
  15. for (long i = 1; i <= n; i++)
  16. for (long j = 1; j <= m; j++){
  17. cin >> arr[i][j];
  18. if (i % 2 == 0){
  19. sum += arr[i][j];
  20. }
  21. }
  22. cout << "Сумма: " << sum << '\n';
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement