Last active
May 26, 2016 19:49
-
-
Save Cloudef/e699b641a3c5358b16bead75ad37591c to your computer and use it in GitHub Desktop.
This file contains 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
#include <stdio.h> | |
#include <stdint.h> | |
void main(void) | |
{ | |
char num[4]; | |
const char *lut[] = { num, "Fizz\n", "Buff\n", "FizzBuff\n" }; | |
for (uint32_t i = 1; i <= 100; ++i) { | |
const uint8_t n = !(i % 3) + (2 * !(i % 5)); | |
snprintf(num, sizeof(num), "%d\n", i); | |
printf("%s", lut[n]); | |
} | |
} |
This file contains 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
#include <stdio.h> | |
#include <stdint.h> | |
void main(void) | |
{ | |
const char *lut[] = { "", "Fizz\n", "Buff\n", "FizzBuff\n" }; | |
for (uint32_t i = 1; i <= 100; ++i) { | |
const uint8_t n = !(i % 3) + (2 * !(i % 5)); | |
printf("%s", lut[n]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment