fork download
  1. #include <stdio.h>
  2.  
  3. #define TOTAL 20
  4.  
  5. int main(void)
  6. {
  7. short pows[TOTAL] = {0};
  8. size_t count = 0;
  9. size_t sz_ar = sizeof(pows) / sizeof(*pows);
  10.  
  11. while(count < sz_ar && scanf("%hd", &pows[count]) == 1)
  12. count++;
  13.  
  14. for (int i = 0; i < count; i++) {
  15. if (pows[i] % 2 == 0) {
  16.  
  17. for (int j = i; j < count - 1; j++) {
  18. pows[j] = pows[j+1];
  19. }
  20.  
  21. pows[count - 1] = 0;
  22. count--;
  23. break;
  24. }
  25. }
  26.  
  27. for (int t = 0; t < count; t++) {
  28. printf("%d ", pows[t]);
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5320KB
stdin
1 3 5 7 8 4 3 2 1
stdout
1 3 5 7 4 3 2 1