When kind of solution do people want to see the most when they ask for a FizzBuzz, besides a working one?

When kind of solution do people want to see the most when they ask for a FizzBuzz, besides a working one?

Nobody asks for a fizzbuzz outside of Sup Forums.

Without conditionals.

for (let i = 1; i

one line of perl, the more nonsensical the better

#include
int main()
{
for (int i=0;++i

Don't let the wonky indentation fool you. This is what a top-grade fizzbuzz looks like:

(define (fizzbuzz n conds)
(let ((fizzed?
(lambda (y)
(foldl (lambda (acc x)
(if (fx= 0 (modulo y (car x)))
(begin (display (cadr x)) #t)
acc))
#f
conds))))
(for-each (lambda (z)
(if (fizzed? z)
(newline)
(begin (display z)
(newline))))
(iota n 1))))

(fizzbuzz 21 '((3 fizz)(5 buzz)))
1
2
fizz
4
buzz
fizz
7
8
fizz
buzz
11
fizz
13
14
fizzbuzz
16
17
fizz
19
buzz
fizz

Notice how extensible it is:
(fizzbuzz 21 '((3 fizz)(5 buzz)(7 baz)))
1
2
fizz
4
buzz
fizz
baz
8
fizz
buzz
11
fizz
13
baz
fizzbuzz
16
17
fizz
19
buzz
fizzbaz

#include

int i;

int main() {

void(*cases[])() = {
[]() {printf("%d\n", i); },
[]() {printf("Fizz\n"); },
[]() {printf("Buzz\n"); },
[]() {printf("FizzBuzz\n"); }
};

for (i = 0; i

lisp is nice
wish i could use it for something useful

Nothing's stopping you.

...

Assert your dominance by getting them to do fizzbuzz for you.

print('Please input the numbers 1 through 100 but for multiples of three type "fizz" and multiple of five type "buzz" instead. For numbers which are multiples of both three and five type "fizzbuzz" instead.')

fizzbuzz = []

for i in range(100):
fizzbuzz.append(input())

print('Here is my solution for fizzbuzz:')

for i, num in enumerate(fizzbuzz):
print(fizzbuzz[i])

/thread

>doesn't even verify the result and demand that they go back and change it

for x in range(1, 200):

fizz = not x % 3
buzz = not x % 5

if fizz and buzz :
print ("FizzBuzz")
elif fizz:
print ("Fizz")
elif buzz:
print ("Buzz")
else:
print (x)

python is cute

>for x in range(1, 200)
>range(1, 200)
>200

you failed

They want to see the shortest possible one-line fizzbuzz.
The shorter it is the more they will praise you for being efficient
because we all know it takes more time the more keys are being pressed.
When they ask, next time just give them this
for(let i=1;i

for i in range(1,101): print("Fizz"*(i%3==0) + "Buzz"*(i%5==0) or i)

Are those anonymous functions?

Code readability is a big thing so enjoy your unemployment

you just put an one liner in 30s, cross your arms and ask for the real test.

That would be this one (gaze in awe you faggits):
#include
int main()
{
for(int i=1;i

This is the most elegant one.

python is so simple it's just writes itself

a functional one
def fizzbuzz(n):
if n % 15 == 0: return "FizzBuzz"
if n % 3 == 0: return "Fizz"
if n % 5 == 0: return "Buzz"
return str(n)

print("\n".join(map(fizzbuzz,range(1,100))))

That was an obvious joke

Just stupid or trying hard to be?

def fizzbuzz (n):
return "fizzbuzz" if (n%5==0 and n%3==0) else ("fizz" if n%3==0 else "buzz")

def main ():
s = [(str(x) + " -> " + fizzbuzz(x)) for x in range(1,101)]
print("\n".join(s))

if __name__ == "__main__":
main()

Well it looks sorta like an array of function pointers but I've never seen that syntax in C before

I tried compiling it an found out it was C++ which I guess is why I was confused because it was including

#include

int main()
{
int i;
const char *fmts[] = {"%.*s%.*s%d\n", "%.*s%.*s\n"};

for (i = 1; i

this thread lacks some C++
#include
using namespace std;
int main() {
for (int i=1; i

C++ lacks orthogonality.

Huh, I didn't know print returned a thing.

fizzbuzz is supposed to show that you're actually able to do it, but also your thought process, and how modular it is (how easily can you add "woof"?)

your mom's clit lacks orthogonality, you worthless niggerfaggot

#include
#include

#define FIZZBUZZ_CASE(term) case term: printf("FizzBuzz\n"); break
#define FIZZ_CASE(term) case term: printf("Fizz\n"); break
#define BUZZ_CASE(term) case term: printf("Buzz\n"); break
#define EMPTY_CASE(term) case term:
#define NORMAL_CASE(term) case term: printf("%d\n", i); break

int main(void)
{
int i;
for (i = 1; i = 0) j = j - 15;

switch (j)
{
FIZZBUZZ_CASE(0);
EMPTY_CASE(1);
NORMAL_CASE(2);
FIZZ_CASE(3);
NORMAL_CASE(4);
BUZZ_CASE(5);
FIZZ_CASE(6);
EMPTY_CASE(7);
NORMAL_CASE(8);
FIZZ_CASE(9);
BUZZ_CASE(10);
NORMAL_CASE(11);
FIZZ_CASE(12);
EMPTY_CASE(13);
NORMAL_CASE(14);
}
}

return 0;
}

I know, right? I've never been so delighted leafing through the c documentation. All these years, one of the most basic standard functions which I've used countless times, and i didn't even know what it had been returning.