#include <iostream>
using namespace std;
int main()
{
const int row_size = 20;
const int col_size = 20;
int arr[row_size][col_size];
int row; cout << " Enter row = "; cin >> row;
int col; cout << " Enter col = "; cin >> col;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
cout << " Enter arr[" << i << "][" << j << "] = ";
cin >> arr[i][j];
}
int sum = 0;
for (int i = 0; i < row; i++){
sum += arr[i][j];
cout << " " << sum;
sum = 0;
cout << endl;
return 0;
Объяснение:
Ручки
#include <iostream>
using namespace std;
int main()
{
const int row_size = 20;
const int col_size = 20;
int arr[row_size][col_size];
int row; cout << " Enter row = "; cin >> row;
int col; cout << " Enter col = "; cin >> col;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
cout << " Enter arr[" << i << "][" << j << "] = ";
cin >> arr[i][j];
}
}
int sum = 0;
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++) {
sum += arr[i][j];
}
cout << " " << sum;
sum = 0;
}
cout << endl;
return 0;
}
Объяснение:
Ручки