Fizzbuzz in your language of choice right now!

Fizzbuzz in your language of choice right now!

Attached: whiteboard.jpg (1840x1123, 146K)

Other urls found in this thread:

github.com/Kikebook/fbos
youtu.be/SwK2c95eV4Y
twitter.com/NSFWRedditVideo

for(let i=0;i

#include

int main ()
{
char txt[100] = "";
char num[100];
int i;

for (i = 1; i

fizzbuzz


Save as fizzbuzz.fizzbuzz and compile with fizzbuzzcc -o fizzbuzz fizzbuzz.fizzbuzz

#include

int main()
{
std::cout

Please use the whiteboard.

Uhmm, no sweetie. Did you just assume my gender? I'll tell everyone that you raped me unless I get the job, you misogynist pig!

whiteboards are for gaylords

Attached: Untitled.png (1840x1123, 1.37M)

I saved this image to my Jow Forums folder, but because the file name "Untitled" was already taken I named it "Untitledick"

Hired.

Why does my handwriting on a mouse+keyboard look identical to my handwriting irl

>resume says I have masters in compsci with focus on algorithms
>do a fizzbuzz on whiteboard
Actually happened and I felt so insulted I walked away.

There are people that fail even with masters

Attached: whiteboardfizzbuzz.jpg (1840x4960, 2.64M)

#include
using namespace std;
int main(){

for (int i=1;i

That's fucking top tier humor my dude

I would fizzbuzz in assembly x86, but it's way beyond max character limit, so, here's python I guess

from fizzbuzz import *
fizzbuzz()

that just means you're skilled with a mouse or your handwriting sucks ass

Attached: Untitled.png (1536x864, 79K)

Here you go sir Raja.
I've used recursion, because it's more fun than simple loops.
Sorry for my terrible handwritting, naturaly I type most of the day and handwrite very rarely.

Am I hired..?

Attached: whiteboardfizzbuzz.jpg (1840x1123, 246K)

>it took him multiple lines of code

print("1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n31\n32\nFizz\n34\nBuzz\nFizz\n37\n38\nFizz\nBuzz\n41\nFizz\n43\n44\nFizzBuzz\n46\n47\nFizz\n49\nBuzz\nFizz\n52\n53\nFizz\nBuzz\n56\nFizz\n58\n59\nFizzBuzz\n61\n62\nFizz\n64\nBuzz\nFizz\n67\n68\nFizz\nBuzz\n71\nFizz\n73\n74\nFizzBuzz\n76\n77\nFizz\n79\nBuzz\nFizz\n82\n83\nFizz\nBuzz\n86\nFizz\n88\n89\nFizzBuzz\n91\n92\nFizz\n94\nBuzz\nFizz\n97\n98\nFizz\nBuzz")

Here you are sir please do the needful

Attached: white board interview.png (1840x1123, 1.48M)

10 PRINT"THIS THREAD AGAIN"
20 PRINT"FUCK YOU WITH A BENT POLE OP"
30 GOTO 10

Attached: fizbuzzwhiteboard.jpg (1840x1123, 367K)

> It took him more than 56 bytes

i=0;exec"print i%3/2*'Fizz'+i%5/4*'Buzz'or-~i;i+=1;"*100

for i in range(1,101):print ("FIZZBUZZ"[(i%3!=0)*4:(i%5==0)*8+4]or i)

I like this one
clever

for i in range(101):print "FizzBuzz"[i*i%3*4:8--i**4%5]or i

Is this superior to using if()s?

### Functions ###
range = $(if $(filter $1,$(lastword $3)),$3,$(call range,$1,$2,$3 $(words $3)))
make_range = $(foreach i,$(call range,$1),$(call range,$2))
equal = $(if $(filter-out $1,$2),,$1)


### Variables ###
limit := 101
numbers := $(wordlist 2,$(limit),$(call range,$(limit)))

threes := $(wordlist 2,$(limit),$(call make_range,$(limit),2))
fives := $(wordlist 2,$(limit),$(call make_range,$(limit),4))

fizzbuzz := $(foreach v,$(numbers),\
$(if $(and $(call equal,0,$(word $(v),$(threes))),$(call equal,0,$(word $(v),$(fives)))),FizzBuzz,\
$(if $(call equal,0,$(word $(v),$(threes))),Fizz,\
$(if $(call equal,0,$(word $(v),$(fives))),Buzz,$(v)))))


### Target ###
.PHONY: all
all: ; $(info $(fizzbuzz))

fizz = buzz
prove me wrong

fizz must be divisible by 3
buzz must be divisible by 5

Both 3 and 5 are prime, therefore there exists at least one fizz that isn't a buzz and at least one buzz that isn't a fizz.

QED.

MATLAB
If you don't understand this trivial code you will forever be a codemonkey.

The same goes if you can't write fizzbuzz without for loops.

Attached: Screenshot_20180526-165324.png (2880x1440, 122K)

The marker won't come off.
I'm sorry.

Attached: 853623199574189.png (1840x1123, 1M)

where does it print the numbers?

Not him, but you get exactly one guess what "puts" does.

This one thread has been repeatedly posted for about a decade.
Nobody cares how you do a basic loop with the most basic of basic if statements. It's not relevant. It's tedious even.
Stop it.
Get some help.

++++++++++[>++++++++++>++++++++++>->>>>>>>>>>>>>>>>-->+++++++[->++
++++++++[->+>+>+>+>++++++++[-]++++
+[-]>>-->++++++[->+++++++++++[->+>+>+>+++++++>++++++++[-]++++++[-]>>-->
---+[-+>[-]++[-->++]-->+++[---++[-->-[+
+++[----]++[-->++]--++[--+[->[-]+++++[---->++++]-->[
->+>[.>]++[-->++]]-->+++]---+[->-[+>>>+[->>++++++++++-[>+>>]>[+[-]>+>>]+>>]>[+[-]>
+>>]

No, user; she means that I don't have an else statement that prints numbers that are not divisible by 15, 5, or 3.
I don't have one because I'm a silly goose.

Import fizzbuzz from 'fizzbuzz';
Console.log(fizzbuzz());

honk honk

I get unreasonable irate if there are three separate evaluations for 'fizz', 'buzz' and 'fizzbuzz', is it autism?

Drop the else if, you need "FizzBuzz" if i % 3 == 0 && i % 5 == 0

The whole point of "fizzbuzz" question is to determinate your understanding of Function use

You can make it in fewer iterations?

Why not "undicklet"

%

Yes

Some specifications require the (x%5==0 && x%3==0) case to be printed with punctuation e.g. Fizz-Buzz

seq 100|sed 5~5cBuzz|sed 3~3s/[^B]*/Fizz/

With Fallout terminal font (Monofonto) and a lang to match.

Attached: iusedthegreenmarker.jpg (1840x1123, 154K)

for i in range(1, 21):
if (i % 3 == 0 and i%5 == 0):
print("fizzbuzz")
elif(i % 3==0):
print("fizz")
elif(i % 5==0):
print("buzz")
else:
print(i)

#include

int main(void)
{
int i;

i = 0;
while(i++ < 100) {
printf("%d ", i);
switch(i % 15) {
case 3:
case 6:
case 9:
case 12:
case 18:
puts("Fizz");
break;
case 5:
case 10:
puts("Buzz");
break;
case 0:
puts("FizzBuzz");
break;
default:
puts("");
}
}
return 0;
}

case 18 unnecessary obv

the point of fizzbuzz is to see whether the programmer will get wrapped up in the fact that you can't really do it without either duplicating the conditions or explicitly using variables. the only proper way to solve it is to use a language that supports macros, and i mean macros in the lisp sense, not the C sense.

(defmacro all-or (&rest clauses)
"CLAUSES is a list of clauses of the form (TEST BODY). The clauses are
processed sequentially in the order given and their BODY is executed only if
their TEST evaluates to true."
(let* ((all (remove-if (lambda (c) (eq (car c) t)) clauses))
(or (find-if (lambda (c) (eq (car c) t)) clauses))
(syms (loop :repeat (length all)
:collect (gensym))))
`(let (,@syms)
,@(mapcar (lambda (c g) `(when ,(car c) (setf ,g t) ,@(cdr c)))
all syms)
(when (and ,@(mapcar (lambda (g) `(not ,g)) syms))
,@(cdr or)))))

(defun fizzbuzz (n)
(dotimes (i n)
(let ((i (1+ i)))
(all-or
((zerop (mod i 3)) (princ "fizz"))
((zerop (mod i 5)) (princ "buzz"))
(t (princ i)))
(terpri))))


the above definition of fizzbuzz macroexpands to:

(defun fizzbuzz (n)
(dotimes (i n)
(let ((i (1+ i)))
(LET (#:G670 #:G671)
(WHEN (ZEROP (MOD I 3)) (SETF #:G670 T) (PRINC "fizz"))
(WHEN (ZEROP (MOD I 5)) (SETF #:G671 T) (PRINC "buzz"))
(WHEN (AND (NOT #:G670) (NOT #:G671)) (PRINC I)))
(terpri))))


it uses variables underneath, of course, because there's no other way to do it. but this doesn't dirty the source code itself because it's "hidden" away within a *properly-named* and *documented* macro.

github.com/Kikebook/fbos

youtu.be/SwK2c95eV4Y

Attached: Brak's Dad 2.png (512x380, 245K)

forgot to document the special T clause. this syntax highlighter sucks dick btw.

(defmacro all-or (&rest clauses)
"The macro accepts an arbitrary number of clauses. Each clause is of the
form (TEST BODY). The macro processes the clauses sequentially in the order
given and arranges for a clause's BODY to be executed if its TEST evaluates to
true. The first clause whose TEST form is T is treated specially and is executed
only if no other clauses were executed. Other clauses whose TEST form is T are
ignored."
(let* ((all (remove-if (lambda (c) (eq (car c) t)) clauses))
(or (find-if (lambda (c) (eq (car c) t)) clauses))
(syms (loop :repeat (length all) :collect (gensym))))
`(let (,@syms)
,@(mapcar (lambda (c g) `(when ,(car c) (setf ,g t) ,@(cdr c)))
all syms)
(when (and ,@(mapcar (lambda (g) `(not ,g)) syms))
,@(cdr or)))))


(defun fizzbuzz (n)
(dotimes (i n)
(let ((i (1+ i)))
(all-or
((zerop (mod i 3)) (princ "fizz"))
((zerop (mod i 5)) (princ "buzz"))
(t (princ i)))
(terpri))))

Attached: shot.png (645x486, 12K)

library ieee;
use ieee.std_logic_1164.all;
library std;
use std.textio.all;

entity fizzbuzz is
end fizzbuzz;

architecture structural of fizzbuzz is
begin
process
begin
for i in 1 to 100 loop
if i mod 3 = 0 and i mod 5 = 0 then
write (output, "FIZZBUZZ" & LF);
elsif i mod 3 = 0 then
write (output, "FIZZ" & LF);
elsif i mod 5 = 0 then
write (output, "BUZZ" & LF);
else
write (output, integer'image(i) & LF);
end if;
end loop;
wait;
end process;
end architecture;

Get ready to flip burgers, dumb ass.

what language is that? It's efficient as fuck.

Import fizzbuzz

Main =. Fizzbuzz™

x = 1:100
y = as.character(x)
y[x %% 3 == 0] = "fizz"
y[x %% 5 == 0] = "buzz"
y[(x %% 3 == 0) & (x %% 5 == 0)] = "fizzbuzz"

>console
It's javascript.

% pdftex fizzbuzz.tex
\nopagenumbers
\font\titlefont=cmb20
\font\subtitlefont=cmsl14
\input eplain

\vbox to \vsize {%
\vfill
\centerline{\titlefont FizzBuzz in \TeX}
\medskip
\centerline{\subtitlefont By Anonymous}
\centerline{\subtitlefont \today}
\vfill
} \eject

{\tt
\hrule\bigskip
\newcount\n
\newcount\x
\n=1
\loop\ifnum\n

No, the point of FizzBuzz is to weed out people who can't program their way out of a wet paper bag.

Druk alle integers af op een nieuwe regel. Vervang alle integers deelbaar door drie met de tekst 'fizz'. Vervang integers deelbaar door 5 met 'buzz'. Vervang integers deelbaar door beide met 'fizzbuzz'.

1
2
2Fizz
4
4Buzz
4BuzzFizz
7
8
8Fizz
8FizzBuzz
11
11Fizz
13
14
14Fizz
16
17
17Fizz
19
19Buzz
19BuzzFizz
22
23
23Fizz
23FizzBuzz
26
26Fizz
28
29
29Fizz
31
32
32Fizz
34
34Buzz
34BuzzFizz

#include

int main()
{
int target = 100;
int current = 0;
int trigger = 0;
while(current != target)
{
if(current % 3 == 0) {
printf("Fizz");
trigger = 1;
}
if(current % 5 == 0) {
printf("Buzz");
trigger = 1;
}
if(trigger == 0) {
printf("%d", current);
}else{
trigger = 0;
}
printf("\n");
current++;
}
return 0;
}

#include

int main ()
{
int i=1;

while(i

Great stuff, but consider this:
++++++++++[>++++++++++>++++++++++>->>>>>>>>>>>>>>>>-->+++++++[->++++++++++[->+>+>+>+>++++++++[-]++++ +[-]>>-->++++++[->+++++++++++[->+>+>+>+++++++>++++++++[-]++++++[-]>>--> ---+[-+>[-]++[-->++]-->+++[---++[-->-[+ +++[----]++[-->++]--++[--+[->[-]+++++[---->++++]-->[ ->+>[.>]++[-->++]]-->+++]---+[->-[+>>>+[->>++++++++++-[>+>>]>[+[-]>+>>]+>>]>[+[-]> +>>]

const fizzbuzz = require('fizzbuzz')

fizzbuzz()

from test_solutions import fizzbuzz
fizzbuzz.run()

Nice, but I think that it would be slightly clearer if you had used the bool() method:
for i in range(1,101): print('fizzbuzz'[bool(i%3)*4: 8 - bool(i%5)*4] or i)

It's possible to do this using only (i^2)%5, which equals either 1, 0, 4 depending on i. You can then map (1,0,4)->(-4,0,4) using a 2nd order polynomial. Check this out ;^)
for i in range(1,101):
print('fizzbuzz'[(i*i%3)*4: 8 + (11*(i**2%5)**2-47*(i**2%5))//3] or i)

It's basically relying on how python treats a negative index
"fizzbuzz"[4: -4] or 1 = 1
"fizzbuzz"[4: 4] or 2 = 2
"fizzbuzz"[0: 4] or 3 = 'fizz'
"fizzbuzz"[4: -4] or 4 = 4
"fizzbuzz"[4: 8] or 5 = 'buzz'
"fizzbuzz"[0: -4] or 6 = 'fizz'
"fizzbuzz"[4: 4] or 7 = 7
"fizzbuzz"[4: 4] or 8 = 8
"fizzbuzz"[0: -4] or 9 = 'fizz'
"fizzbuzz"[4: 8] or 10 = 'buzz'
"fizzbuzz"[4: -4] or 11 = 11
"fizzbuzz"[0: 4] or 12 = 'fizz'
"fizzbuzz"[4: 4] or 13 = 13
"fizzbuzz"[4: -4] or 14 = 14
"fizzbuzz"[0: 8] or 15 = 'fizzbuzz'

Yes, I realise that I am retarded.

Attached: IMG_20180906_192645.jpg (2340x4160, 3.46M)

what did you use here? I'm really new to C.

Sir,
i am please to reporting i solved your large problem in less than a day

System.out.println("FizzBuzz");

>he tests for mod 15

Attached: 1529678107008.gif (500x600, 790K)