Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "rus");
- int N, M, sum, u;
- cout << "Введите кол-во столбцов: ";
- cin >> N;
- cout << "Введите кол-во строк: ";
- cin >> M;
- int *b = new int[M];
- for (int i = 0; i < M; i++) {
- sum = 0;
- for (int t = 0; t < N; t++) {
- cout << "Введите элемент " << t + 1 << " строки " << i + 1 << ": ";
- cin >> u;
- sum += u;
- }
- b[i] = sum;
- }
- cout << "Сумма:" << endl;
- for (int i = 0; i < M; i++) {
- cout << b[i] << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement