Friday, November 16, 2012

fizz buzz, now with obscurity!

I saw that some 60% of some job applicants cant fizzbuzz.

Let's see my attempt.



#include <cstdio>
void fizzbuzz(){
    int th,fi,i;
    for(th=0,fi=0,i=0;i<16;++i,th=(i%3==0),fi=(i%5==0),!((th&&puts("fizz"))|(fi&&puts("buzz")))&&(printf("%d\n",i)));
}

int main() {
    fizzbuzz();
    return 0;
}

Can you tweak this so that multiples of 15 fizzbuzz instead of fizz\nbuzz?
http://ideone.com/VwmEEt