Skip to content

Instantly share code, notes, and snippets.

@cgsdev0
Last active May 22, 2023 20:25
Show Gist options
  • Save cgsdev0/ec5d11e62c6f67b84b51d43d1f98803a to your computer and use it in GitHub Desktop.
Save cgsdev0/ec5d11e62c6f67b84b51d43d1f98803a to your computer and use it in GitHub Desktop.
new fizzbuzz just dropped
#include <stdio.h>
#include <stdlib.h>
// boilerplate; ignore this part
#define loop(x) for(int _i=x;_i<=0x64;_i+=x)
#define i c+(_i-1)*012
#define pn sprintf(i,"%d\n",_i)
#define ps(s) strcpy(i,#s"\n")
#define say(s) strcmp(#s,"Number")?ps(s):pn
int main(void) {
// create a buffer on the stack
char c['d'*0xa];
// perform fizzbuzz
loop(0x1) say(Number);
loop(0x3) say(Fizz);
loop(0x5) say(Buzz);
loop(017) say(FizzBuzz);
// print output
loop(0b1) printf("%s", i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment