fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4. #include <stdlib.h>
  5.  
  6. int processArray(int array[], int len) {
  7.  
  8. int n,count=0,i;
  9.  
  10. for(i=0;i<len;i++)
  11.  
  12. {
  13. if(array[i]>10 && array[i]/10==6)
  14. {
  15. //if(array[i]%10== 6)
  16. //count = (array[i]%10==6);
  17.  
  18. i++;
  19.  
  20. }
  21. }
  22. return len;
  23. }
  24.  
  25. int main() {
  26. int *array;
  27. int len = 0, maxsize = 1024, i, input, new_len;
  28. int result;
  29. array = (int *)malloc(maxsize*sizeof(int));
  30. while(scanf("%d", &input) == 1) {
  31. if (input < 0) break; /* Stop when a negative number is entered */
  32. array[len++] = input;
  33. if (len == maxsize) { /* array is full. increase size */
  34. maxsize *= 2;
  35. array = (int *)realloc(array, maxsize*sizeof(int));
  36. }
  37. }
  38. new_len = processArray(array, len);
  39. for(i=0; i<new_len; i++)
  40. printf("%d\n", array[i]);
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0s 5436KB
stdin
3
26
1226
-1
stdout
3
26
1226