fork download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. unsigned foo(char* src)
  5. {
  6. unsigned total = 0;
  7. for (unsigned idx = 0; *src; src++)
  8. total += (++idx & 1) & isdigit(*src);
  9. return total;
  10. }
  11. int main()
  12. {
  13. char symbols[] = "lkdrjvf9ei48r4hjrfwh74h827h34r0239r34jt93o84rtj";
  14. printf("Digits on even places found=%u", foo(symbols)); // здесь должен быть ответ, но он всегда ноль
  15. return 0;
  16. }
Success #stdin #stdout 0s 5576KB
stdin
Standard input is empty
stdout
Digits on even places found=0