Skip to content

Instantly share code, notes, and snippets.

@REPOmAN2v2
Created October 25, 2014 16:29
Show Gist options
  • Save REPOmAN2v2/4cfd3b4d31575e736f51 to your computer and use it in GitHub Desktop.
Save REPOmAN2v2/4cfd3b4d31575e736f51 to your computer and use it in GitHub Desktop.
Clever fizzbuzz
#include <stdio.h>
int main(void) {
const char *messages[] = { "%d\n", "Fizz\n", "Buzz\n", "Fizzbuzz\n" };
for (int i = 1; i <= 100; i++)
printf(messages[!(i % 3) | (!(i % 5) << 1)], i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment