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. // здесь продолжайте программу
  15.  
  16. for (int i = 0; i < count; i++) {
  17. if (pows[i] % 3 == 0 ) {
  18.  
  19. for (int j = i; j < count - 1; j++) {
  20.  
  21. pows[j] = pows[j + 1];
  22.  
  23. }
  24.  
  25. count--;
  26. i--;
  27. }
  28. }
  29.  
  30. if (count > 0) {
  31.  
  32. for (int t = 0; t < count; t++) {
  33. printf("%d ", pows[t]);
  34. }
  35.  
  36. } else if (count == 0) {
  37.  
  38. printf("Array is empty");
  39.  
  40. }
  41.  
  42. return 0;
  43. }
Success #stdin #stdout 0s 5316KB
stdin
3 4
stdout
4