Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int N = 10;;
- int n;
- int mas[N];
- int st[N];
- int k = 0;
- long long mult = 1;
- long long sum = 0;
- bool flag = 0;
- int main () {
- cin >> n;
- for (int i = 0; i < n; i++) {
- cin >> mas[i];
- if (i % 2 == 0) {
- mult *= mas[i];
- }
- if (!mas[i]) {
- st[k++] = i;
- }
- }
- if (k) {
- for (int i = st[0]; i < st[k - 1]; i++) {
- sum += mas[i];
- }
- }
- cout << "even elements multiply " << mult << endl;
- cout << "elemts sum beatween first and last zero " << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment