Skip to content

Instantly share code, notes, and snippets.

@socantre
Created May 13, 2015 04:25
Show Gist options
  • Save socantre/d9f18bdf3112d0cba85a to your computer and use it in GitHub Desktop.
Save socantre/d9f18bdf3112d0cba85a to your computer and use it in GitHub Desktop.
FizzBuzz
#include <cstdio>
int main() {
int a = 810092048, b = a, c[] = {'\n\0i%','ziF\0', 'uB\0z', 'F\0zz', 'Bzzi', 'zzu'};
for (int d = 1; d <= 100; ++d, b = (b >>= 2) ? b : a) {
std::printf((char*)c+(b&3)*5, d); std::printf((char*)c+3);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment