prestige

Untitled

Jun 15th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. const int N = 10;;
  4. int n;
  5. int mas[N];
  6. int st[N];
  7. int k = 0;
  8. long long mult = 1;
  9. long long sum = 0;
  10. bool flag = 0;
  11. int main () {
  12. cin >> n;
  13. for (int i = 0; i < n; i++) {
  14. cin >> mas[i];
  15. if (i % 2 == 0) {
  16. mult *= mas[i];
  17. }
  18. if (!mas[i]) {
  19. st[k++] = i;
  20. }
  21. }
  22. if (k) {
  23. for (int i = st[0]; i < st[k - 1]; i++) {
  24. sum += mas[i];
  25. }
  26. }
  27. cout << "even elements multiply " << mult << endl;
  28. cout << "elemts sum beatween first and last zero " << sum << endl;
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment