SHARE
TWEET

#159

a guest Mar 25th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n,i,k=0;
  7.     cin>>n;
  8.     int v[n*2];
  9.     for(i=0;i<=n-1;i++){
  10.         cin>>v[k];
  11.         if(v[k]%2==0){
  12.             k++;
  13.         }
  14.         k++;
  15.     }
  16.     for(i=0;i<k;i++){
  17.         if(v[i]%2==0){
  18.             v[i+1]=v[i]*2;
  19.             i++;
  20.         }
  21.     }
  22.     for(i=0;i<k;i++){
  23.         cout<<v[i]<<" ";
  24.     }
  25.     return 0;
  26. }
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