Guest User

Untitled

a guest
Nov 13th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. int size = 4;
  2. int list[4] = {12,3,7,8};
  3. int temp;
  4.  
  5. cout<<endl;
  6. int Evens = 0;
  7. for (int i = 0; i < size; i++){
  8.  
  9. if (list[i] % 2 == 0){
  10. temp = list[i];
  11.  
  12. for (int j = i; j > Evens; j--){
  13. list[j] = list[j - 1];}
  14. list[Evens] = temp;
  15. Evens++;
  16. cout<<list[i];
  17. }
  18. }
  19.  
  20. for(int i = 0; i < size; i++){
  21. cout<<list[i];
  22. cout<<" | ";
  23. }
  24. return 0;
Add Comment
Please, Sign In to add comment