Skip to content

Instantly share code, notes, and snippets.

@mattn
Created October 4, 2017 16:10
Show Gist options
  • Select an option

  • Save mattn/7339de0529a2966bc6c623f18b753187 to your computer and use it in GitHub Desktop.

Select an option

Save mattn/7339de0529a2966bc6c623f18b753187 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void) {
int n = 600000 * 3;
int i = 1;
long c;
char buf[BUFSIZ];
setbuf(stdout, buf);
for (i = 1; i <= n; i++) {
if (i % 3 == 0 && i % 5 == 0) {
c += printf("FizzBuzz\n");
}
else if (i % 3 == 0) {
c += printf("Fizz\n");
}
else if (i % 5 == 0) {
c += printf("Buzz\n");
}
else {
c += printf("\%d\n", i);
}
}
fprintf(stderr, "%d\n", c);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment