Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Rus");
- srand(time(0));
- int N;
- int P = 1;
- cout << "Количество элементов массива: .";
- cin >> N;
- int* a = new int[N];
- for (int i = 0; i < N; i++) {
- a[i] = rand() % 20;
- cout << a[i] << " ";
- }
- cout << endl;
- for (int i = 0; i < N; i += 2)
- P *= a[i];
- cout << "Произведение элементов стоящих на четных местах : " << P;
- cout << endl;
- delete[] a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment