Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     setlocale(LC_ALL, "rus");
  7.     int N, M, sum, u;
  8.     cout << "Введите кол-во столбцов: ";
  9.     cin >> N;
  10.     cout << "Введите кол-во строк: ";
  11.     cin >> M;
  12.     int *b = new int[M];
  13.     for (int i = 0; i < M; i++) {
  14.         sum = 0;
  15.         for (int t = 0; t < N; t++) {
  16.             cout << "Введите элемент " << t + 1 << " строки " << i + 1 << ": ";
  17.             cin >> u;
  18.             sum += u;
  19.         }
  20.         b[i] = sum;
  21.     }
  22.     cout << "Сумма:" << endl;
  23.     for (int i = 0; i < M; i++) {
  24.         cout << b[i] << endl;
  25.     }
  26.     system("pause");
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement