Skip to content

Instantly share code, notes, and snippets.

@akoskovacs
Last active April 26, 2018 11:35
Show Gist options
  • Save akoskovacs/47bb9e7b0330d3b0a6ab17186851aeae to your computer and use it in GitHub Desktop.
Save akoskovacs/47bb9e7b0330d3b0a6ab17186851aeae to your computer and use it in GitHub Desktop.
FizzBuzz magic in C
/* Totally patented by Ákos Kovács */
#include <stdio.h>
void fizzbuzz(int n)
{
int i;
char fb[][5] = { "Fizz", "Buzz", "%d" };
for (i = 1; i <= n; i++) {
*((*fb)+4)=i%15?0x0:0x07;
printf(*(fb+(i%5?!!(i%3)*2:!!(i%3))), i);
printf("\x0a");
}
}
int main(int argc, const char *argv[])
{
fizzbuzz(100);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment