fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. int n, cnt = 0, i;
  7. char s[30];
  8. printf("n = ");
  9. scanf("%d", &n);
  10. for ( i = 1; i <= n; ++i) {
  11. sprintf(s, "%d", i);
  12. cnt += (strchr(s, '3') == NULL) && (strchr(s, '5') == NULL);
  13. }
  14. printf("%d\n", cnt);
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 1724KB
stdin
40
stdout
n = 24