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;
- int P = 1;
- int sum = 0;
- cout << " Введите количество элементов массива: ";
- cin >> N;
- int* a = new int[N];
- cout << "Введите элементы массива: " << endl;
- for (int i = 1; i < N; i++)
- {
- cin >> a[i];
- }
- for (int i = 1; i < N; i++)
- {
- if (a[i] > 0)
- P *= a[i];
- if (a[i] < 0)
- sum++;
- }
- cout << " Произведение положительных элементов массива равна : " << P << endl;
- cout << "Количество отрицательныъ элементов массива равна: " << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment