Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main() {
- const int n = 4;
- int array[n][n], y[n], res;
- cout << "Enter array" << endl;
- for (int i = 0; i < n; ++i)
- {
- for (int j = 0; j < n; ++j)
- {
- cout << "[" << i << "][" << j << "] = ";
- cin >> array[i][j];
- }
- }
- cout << "ur array" << endl;
- for (int i = 0; i < n; ++i)
- {
- for (int j = 0; j < n; ++j)
- cout << array[i][j] << " ";
- cout << endl;
- }
- for (int i = 0; i < n; ++i)
- {
- res = 0;
- for (int j = 0; j < n; ++j)
- {
- res += array[i][j];
- }
- y[i] = res;
- }
- for (int i = 0; i < n; ++i)
- cout << "New array[" << i << "] = " << y[i] << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement