Advertisement
add1ctus

Парни броеви во низа

Dec 24th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n;
  7.     cin>>n;
  8.     int b[n];
  9.     for(int i = 0 ; i < n ; i++)
  10.         cin>>b[i];
  11.  
  12.     int a[n];
  13.     int brojac = 0;
  14.     for(int i = 0 ; i < n ; i++)
  15.         if(b[i] % 2 == 0)
  16.         {
  17.             a[brojac] = b[i];
  18.             brojac++;
  19.         }
  20.  
  21.     for(int i = 0 ; i < brojac ; ++i)
  22.         cout<<a[i]<<" ";
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement