Last active
April 26, 2018 11:35
-
-
Save akoskovacs/47bb9e7b0330d3b0a6ab17186851aeae to your computer and use it in GitHub Desktop.
FizzBuzz magic in C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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