Advertisement
Josif_tepe

Untitled

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