Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- int n;
- cout << "Vvedite n: ";
- cin >> n;
- int mass[n][n];
- cout << "Vvedite elementi massiva: ";
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- cout << "[" << i << "]" << "[" << j << "] = ";
- cin >> mass[i][j];
- }
- }
- cout << "Massiv: " << endl;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- cout << setw(3) << mass[i][j] << setw(3);
- }
- cout << endl;
- }
- int sum = 0;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- if (mass[i][j] % 2 == 0)
- {
- sum += mass[i][j];
- }
- }
- }
- cout << "sum = " << sum << endl;
- double sr = 0;
- for (int i = 0; i < n; i++)
- {
- sr += mass[i][2];
- }
- sr /= n;
- cout << "sr = " << sr << endl;
- }
Add Comment
Please, Sign In to add comment