fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int c57 = 0, c8 = 0, c57x8 = 0;
  5. for (int i = 1; i < 1000000; i++) {
  6. char out_string[7];
  7. sprintf(out_string, "%d", i);
  8. if (strstr(out_string, "57") != NULL) c57++;
  9. if (strstr(out_string, "8") != NULL) c8++;
  10. if (strstr(out_string, "57") != NULL && strstr(out_string, "8") != NULL) c57x8++;
  11. }
  12. printf("c57 = %d\n", c57);
  13. printf("c8 = %d\n", c8);
  14. printf("c57x8 = %d\n", c57x8);
  15. return 0;
  16. }
Success #stdin #stdout 0.08s 4436KB
stdin
Standard input is empty
stdout
c57 = 49401
c8 = 468559
c57x8 = 17081