SHARE
TWEET

Untitled

a guest May 24th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. using namespace std;
  3. int n , a[1000],s,p=-1, u=-1;
  4. int main()
  5. {
  6.      cin>>n;
  7.      for(int i=1;i<=n;i++)
  8.            cin>>a[i];
  9.     for(int i=1;i<=n;i++)
  10.      {
  11.            if(a[i]%2==0)
  12.                 p=a[i];
  13.                u=a[i];
  14.               break;
  15.           
  16.      }
  17.      for(int i=p;i<=n;i++)
  18.          {
  19.              if(a[i]%2==0)
  20.              u=a[i];
  21.          }
  22.          
  23.      if(p==-1)
  24.         cout<<"Nu exista";
  25.     else
  26.        for(int i=p;i<=u;i++)
  27.            s=s+a[i];
  28.        cout<<s;
  29.      return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top