toot.cat is one of the many independent Mastodon servers you can use to participate in the fediverse.
On the internet, everyone knows you're a cat — and that's totally okay.

Administered by:

Server stats:

488
active users

Public

FizzBuzz in gawk, using only printf() and C conditional expressions:

#!/bin/gawk -f

BEGIN {
for (i=1;i<=100;i++) {
printf(" %2s", i%(3*5)!=0 ? i%3!=0 ? i%5!=0 ? i : "buzz" : "fizz" : "fizzbuzz\n" )
}
printf("\n")
}

The more traditional approach is with if/then statements.

I need to check again, but I think if/then actually turns out to run faster. I like the compact form of the example above though.

Edit: tyop.