#include void fizzbuzz(int upto) { const char* fizz = "fizz", *fizzbuzz = "fizzbuzz", *buzz = &fizzbuzz[4]; char s[16] = { '\0' }, *es = &s[14], *eb = &s[14], *et; es[0] = '1'; for (;upto; upto -= 15) { puts(eb); es[0]++; puts(eb); puts(fizz); es[0] += 2; puts(eb); puts(buzz); puts(fizz); if (es[0] > '6') { es[0] -= 7; et = es-1; while (et[0]++ == '9') (et--)[0] = '0'; if (et < eb) { et[0] = '1'; eb = et; } } else es[0] += 3; puts(eb); es[0]++; puts(eb); puts(fizz); puts(buzz); if (es[0] > '6') { es[0] -= 7; et = es-1; while (et[0]++ == '9') (et--)[0] = '0'; if (et < eb) { et[0] = '1'; eb = et; } } else es[0] += 3; puts(eb); puts(fizz); es[0] += 2; puts(eb); es[0]++; puts(eb); puts(fizzbuzz); if (es[0] > '7') { es[0] -= 8; et = es-1; while (et[0]++ == '9') (et--)[0] = '0'; if (et < eb) { et[0] = '1'; eb = et; } } else es[0] += 2; } } int main() { fizzbuzz(9000); return 0; }