Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a[1001];
- int main()
- {
- int n, i, p=-1, u=-1, s=0;
- cin >> n;
- for (i=1; i<=n; ++i)
- {
- cin >> a[i];
- if (a[i]%2==0)
- {
- if (p==-1) {p=i; u=i;}
- if (p!=-1) u=i;
- }
- }
- if (p==-1) cout << "NU EXISTA";
- else
- {
- for (i=p; i<=u; ++i) s+=a[i];
- cout << s;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment