Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using std::cout;
- using std::endl;
- using std::cin;
- int main()
- {
- setlocale(LC_ALL, "rus");
- int n;
- cout << "Кол-во элементов: ";
- cin >> n;
- int *a = new int[n];
- int pro = 1;
- int kol = 0;
- cout << "Введите элементы массивa: ";
- for (int i = 0; i < n; i++)
- {
- cin >> a[i];
- }
- for (int i = 0; i < n; i++)
- {
- if (a[i] > 30 || a[i] < 3)
- {
- kol++;
- pro*= a[i];
- }
- }
- cout << "pro = " << pro << endl;
- cout << "kol = " << kol << endl;
- return 0;
- }
- ______________________________________________________
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "rus");
- int n, m;
- int kol = 0;
- cout << "Arr[n][m]" << endl;
- cout << "n= ";
- cin >> n;
- cout << "m= ";
- cin >> m;
- int **a = new int *[n];
- for (int i = 0; i < n; i++)
- a[i] = new int [m];
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- cout << 1 + j << "-й элемент строки массива: ";
- cin >> a[i][j];
- }
- cout << endl;
- }
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- {
- if (a[i][j] == 1)
- {
- kol++;
- }
- }
- }
- cout << kol << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement