Fizzbuzz

get in here fellas!

#include

int main() {
for (int i = 1; i

Attached: fizzbuzz.jpg (1600x1000, 142K)

Other urls found in this thread:

github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/
pastebin.com/raw/Cgj5sF2s
repl.it/repls/RecklessTotalBrackets
twitter.com/NSFWRedditGif

1 to: 100 do: [:n|
(n \\ 15 == 0) ifTrue: [
'FizzBuzz' printNl.
] ifFalse: [
(n \\ 5 == 0) ifTrue: [
'Buzz' printNl.
] ifFalse: [
(n \\ 3 == 0) ifTrue: [
'Fizz' printNl.
] ifFalse: [
n printNl.
]
]
]
].

what language is that?

Smalltalk

Alright lets do this in python

from fizzbuzz import fizzbuzz

fizzbuzz()

/**
* Plays FizzBuzz up to an arbitrary high given integer.
* FizzBuzz is a game where the goal is to count up to an integer
* n while replacing the multiples of 3 with Fizz, the mutliples
* of 5 with Buzz and the multiples of both 3 and 5 with
* Fizzbuzz. It is a common entry-level problem for gaujing a software
* engineer's expertise and methodological rigor.
* @author Ganesh Satya
* @version %I%
*/
public class FizzBuzz {
/**
* Checks whether an integer is a multiple of another.
* @param n the integer to be tested
* @param q the divisor to be tested
* @return {@code true} if {@code n} is a multiple of {@code q}, {@code false} otherwise
*/
private static boolean isMultiple(final int n, final int q) {
// The integer n is a multiple of q if and only if n = 0 (mod q)
return n % q == 0;
}

/**
* Prints the appropriate FizzBuzz message for a given integer.
* @param n the number of the message
*/
private static void printFizzBuzzMessage(final int n) {
// Since 3 and 5 are co-prime, (3 | n and 5 | n) iff 15 | n
if (isMultiple(n, 15))
System.out.println("Fizzbuzz");
else if (isMultiple(n, 3))
System.out.println("Fizz");
else if (isMultiple(n, 5))
System.out.println("Buzz");
else
System.out.println(n);
}

/**
* Program starting point.
* @param args Command-line arguments, expected to be of length 1
* @throws SecurityException if a call to {@link System#exit} fails (unlikely)
*/
public static void main(String[] args) {
if (args.length == 1) {
try {
final int max = Integer.parseInt(args[0]);
for (int i = 1; i

Attached: Java.png (558x1023, 51K)

Shit function. Why doesn't it take a positive integer to indicate the maximum number? You'll never get a job like this.

Its a meme you dip.

def fizzbuzz_sieve(n):
s = [num for num in range(n)]
for i in range(0,n,3):
s[i] = 'fizz'
for i in range(0,n,5):
if isinstance(s[i], int):
s[i] = 'buzz'
else:
s[i] = 'fizzbuzz'
for x in s:
yield x

print([n for n in fizzbuzz_sieve(100)])


So do I get the job?

Is fizzbuzz a normal thing or a meme based on that one pasta?

It was a meme before the pasta

fizzbuzz i = case (rem i 3, rem i 5) of
(0, 0) -> "fizzbuzz"
(_, 0) -> "buzz"
(0, _) -> "fizz"
_ -> show i

main = mapM_ (putStrLn . fizzbuzz) [1..100]

#import

class.namespace std::std {
public protected unsigned Sint16 Main (str **argc, λ { va_list ap; va_start(ap, va_start); }) {
if [[ ! -z $(for i in range(1): print (Float32 *) 1) ]]; then
putsln('buz fiz')

Attached: image.png (258x120, 36K)

Post that enterprise FizzBuzz solution using Java.

(defn divides? [d n]
(zero? (rem n d)))

(defn fizzbuzz [i]
(condp divides? i
15 "fizzbuzz"
5 "buzz"
3 "fizz"
(str i)))

(->> (range 1 101) (map fizzbuzz)
(interpose "\n") (apply str) print)

Doesn't compile.

#include

int main(void) {
int i;

for(i=1; i

Thank you for applying, user. Don't call us, we'll call you.

This one?
github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition

Stop using Java 6.

it could be
i saw it in fizbuzz thread yesteday

Which java should I use, user?

#include "stdafx.h"
#include
#include
#include

bool doYouWishToContinue() {
std::cout

9 or 10. derp

>@author Ganesh Satya
is that your name, user?

std::string fizzbuzz(int x){
auto kek = [=](int n, std::string s, std::function f){
return x%n == 0 ? [=](std::string){ return s + f(""); } : f; };
auto fuck = std::bind(kek, 3, "fizz", std::placeholders::_1);
auto you = std::bind(kek, 5, "buzz", std::placeholders::_1);
auto op = [](auto s){ return s; };
return fuck(you(op))(std::to_string(x));
}

int main(){
std::vector n(100);
std::iota(n.begin(), n.end(), 1);

for(auto const& i : n)
std::cout

#include

int main() {
for(int i = 0; i

program FizzBuzz;
var
i, n: Integer;
begin
ReadLn(n);
for i := 1 to n do
case i mod 15 of
0:
Write('Fizz Buzz, ');
3, 6, 9, 12:
Write('Fizz, ');
5, 10:
Write('Buzz, ');
else
Write(i, ', ');
end;
end.

print(($_%3?$_%5?$_:'':fizz).($_%5?'':buzz).$/)for(1..100)

a={};
for i=1, 100 do
a[i] = i
end

for i=3, 100, 3 do
a[i] = "fizz"
end

for i=5, 100, 5 do
a[i] = "buzz"
end

for i=15, 100, 15 do
a[i] = "fizzbuzz"
end

for i=1, 100 do
print(a[i])
end

fizz buzz is a tool of the patriarchy to keep women, people of color, those who identify as LGBTQA+, and muslims from entering tech.

css-tricks.com/tales-of-a-non-unicorn-a-story-about-the-trouble-with-job-titles-and-descriptions/

Attached: index.jpg (200x200, 6K)

int main()
{
for(register int x=1;x

>register
lol

As a hiring manager I would be suspicious of someone who could solve fizzbuzz off the cuff. They are likely to:
1. have too much time on their hands
2. had too many interviews asking that question
3. be unsufferably arrogant
4. or all of the above.

FizzBuzz is BS even for “Engineers”. Its supposed to test logical thinking, but its such a strange and narrow problem.

i;main(){for(;i++

>register
>printf

Attached: 1524372719151.jpg (136x244, 11K)

If an interviewer asked me fizz buzz I would have walked off immediately and not looked back.

BTW – I’m a physics/math grad and unless you’ve taken some abstract algebra recently, you will be totally loss.

OMG MATH

pastebin.com/raw/Cgj5sF2s

This one compiled

PROGRAM FB
INTEGER n
DO n = 1, 100
IF (MOD(n, 15) .EQ. 0) THEN
PRINT *, 'FIZZBUZZ'
ELSEIF (MOD(n, 5) .EQ. 0) THEN
PRINT *, 'BUZZ'
ELSEIF (MOD(n, 3) .EQ. 0) THEN
PRINT *, 'FIZZ'
ELSE
PRINT *, n
ENDIF
ENDDO
END

mein neger

Attached: 1506830463933.jpg (507x712, 247K)

repl.it/repls/RecklessTotalBrackets

It's spelled gauging, not gaujing.

What's the problem? Let the compiler decide if that is worth noting or not.

Attached: 1420059333207.jpg (960x960, 175K)

I bet you program in java.

>amount=100
How's your second day programming? Good?

>more competitive fizzmeme shit
let fizz=function(value,arr){
factors=[];
for(let i=0;i

int main()
{
for(i=0,i

this is java ?
without looking into it much it looks allot like C but with allot more useless shit

Good job failing a pajeet-tier problem.

#!/usr/bin/env python3
start = 1 # from start to end
end = 100

for i in range(start, end+1):
output = ""
if i % 3 == 0:
output += "Fizz"
if i % 5 == 0:
output += "Buzz"
if output == "":
print(i)
else:
print(output)

What the fuck is that.

I mean if you were someone who knew jack shit about programming but worked in management you could read this.

>#!/usr/bin/env python3
error:
parse error on input '='
Perhaps you needa 'let' in a 'do' block?
e.g. 'let x = 5' instead of 'x = 5'

I mean in all honesty I kind of sympathize.
She was looking for a front-end design position and barely knew js. It's not hard to throw an exposed backend api and have them design a webpage off it.

>it looks allot like C
Well that's Java
C without explicit pointers, more useless stuff, less powerful mechanics and with a garbage collector
If you don't get C you really don't get Java (for example if you don't get pointers you won't get why Java despite being strictly call by value (like C) behaves like call by reference sometimes)

Java has it's uses, sometimes it's really fast but it isn't as elegant as C.
C is a stroke of genius

She wasn't even the worst desu
The worst was the brew author who couldn't invert a binary tree
I mean literally 3 lines of a recursive function

Im going to throw up

>muh glorious C

infix fun Int.div(a: Int) = this % a == 0

val Int.fizzbuzz get() = when {
this div 15 -> "Fizzbuzz"
this div 3 -> "Fizz"
this div 5 -> "Buzz"
else -> toString()
}

(1..100).forEach { println(it.fizzbuzz) }

rate my fizzbuzz
for i in range(1,100): print(('fizz'*(not i%3) + 'buzz'*(not i%5)) or i)

: . ( n -- )
DUP 5 MOD 0= OVER 3 MOD 0= 2DUP OR IF IF ." Fizz" THEN IF ." Buzz" THEN SPACE DROP ELSE 2DROP . THEN ;

: FIZZBUZZ 101 1 DO I . LOOP ;

Just don't forget to FORGET . (or use MARKER)

#!/usr/bin/env python
import fizzbuzz
fizzbuzz.fizzbuzz()

fizzbuzz

how did i fail ?
i didnt write it out fully because i cant be fucked waisting time on a problem i already solved, but obviously using % in C would return the correct value = ergo it is correct

does anyone have the autism to make fizzbuzz using a single .c file with a main, then header files for every other character

whats wrong with you?

meme off, bro
#define A "Fi"
#define D "Bu"
#define E "z"
#define L E E
#define F L,z
#define R F)
#define G A R
#define H D R
#define I ""
#define K "%d"
#define X printf
#define Y puts
#define Z main
#define M 99
#define N z%5
#define O z%3
#define P Z(z
#define Q P)
#define a Q{X
#define b a(O
#define c b?N
#define d c?K
#define e d:I
#define f e:G
#define i f;Y
#define j i(N
#define k j?I
#define l k:H
#define n l;z
#define o n++
#define p o>M
#define q p?0
#define r q:Q
#define s r;
#define fizzbuzz s}

Attached: 1524799727256.gif (300x300, 2.15M)

It's not supposed to test logical thinking; it's supposed to test that you know how to program. The only thing you need to know to solve FizzBuzz is how to do a loop, how to do if statements, and how to mutate variables. It doesn't even require modulo; that's just the intuitive way to approach the problem. Anyone who has actually spent time programming anything other than Hello World should be able to solve it. And that's the point. It's to filter out people who are lying on their resumes, or who are just complete morons who somehow managed to get a CS degree despite not being able to program.

#include
using std::cout;
using std::endl;

int main() {
for (int n = 1; n

those conditions return true instead of zero.
no remainder returns 0.

you know what i ment nigga

for i=1, 100 do
output = ""
if i%3==0 then
output = output .. "Fizz"
end
if i%5==0 then
output = output .. "Buzz"
end
if output=="" then
output = i
end

print(output)
end

Is it this the thing people fail to program? Or I understood the problem wrong

for(int i =1;i

fizzbuzz(n)
loop from 1 to n
if n divided by 3 and it's remaining is 0 then print fizz
if n divided by 5 and it's remaining is 0 then print buzz
otherwise print n

it's an easy way to filter out applicants who haven't run into the modulo operator before because any good programmer uses the modulo operator constantly in their code

Attached: 2018-05-14 13.17.32.jpg (1003x264, 48K)

puts (1..100)
.map{|i| i%15==0 ? "FizzBuzz" : i}
.map{|i| i% 3==0 ? "Fizz" : i}
.map{|i| i% 5==0 ? "Buzz" : i}

fun main(args: Array) = IntStream.range(0, 100).forEach {
println (when(it) {
15, 30, 45, 60, 75, 90 -> "FizzBuzz"
3, 6, 9, 12, 18, 21, 24, 27, 33, 36, 39, 42, 48, 51, 54, 57, 63, 66, 69, 72, 78, 81, 84, 87, 93, 96, 99 -> "Fizz"
5, 10, 20, 25, 35, 40, 50, 55, 65, 70, 80, 85, 95 -> "Buzz"
else -> it
})
}

>the absolute state of kotlin programmers

WOW
O
W

Asm for a DOS .com program here (this is what passes for "fun" on a Saturday night, God, i'm so bored)

;
; Fizzbuzz for 8086 processors running DOS
;
.model tiny
.code

org 100h

start:
mov cx, 1

test3:
xor dx, dx
mov ax, cx
mov bl, 3
div bl
cmp ah, 0
jnz test5
mov dl, 1
push ax dx
mov dx, OFFSET fizz
mov ah, 9
int 21h
pop dx ax

test5:
mov ax, cx
mov bl, 5
div bl
cmp ah, 0
jnz do_crlf
mov dh, 1
push ax dx
mov dx, OFFSET buzz
mov ah, 9
int 21h
pop dx ax

do_crlf:
cmp dx, 0
jnz newline
mov ax, cx
mov bl, 10
div bl
cmp al, 0
jz print_units
push ax
mov dl, al
add dl, 48
mov ah, 2
int 21h
pop ax
print_units:
mov dl, ah
add dl, 48
mov ah, 2
int 21h

newline:
mov dx, OFFSET crlf
mov ah, 9
int 21h
inc cx
cmp cx, 100
jle test3

mov ax, 4c00h
int 21h

fizz db 'fizz','$'
buzz db 'buzz','$'
crlf db 13,10,'$'

end start

Tfw Java does FP better than Lisp

Attached: 1478577258667.jpg (1024x1024, 167K)

Based Ruby.

define(lp,`ifelse($1,$2,,fb($1)`lp(incr($1), $2)')')dnl
define(fb,`ifelse(eval($1%15),0,FizzBuzz
,eval($1%3),0,Fizz
,eval($1%5),0,Buzz
,$1
)')dnl
lp(1, 101)dnl

var i = 0;
while (i

very nice

I don't know what language this is, but it seems to have several errors.

>No #include
>No spacing between operators
>ironically using register instead of ironically using auto
4/10

node.js

>0FizzBuzz0FizzBuzz0FizzBuzz0FizzBuzz...

wait fuck i forgot i++ please kill me

don't worry user, we can see from your code that you clearly know what you are doing. we'll wrap the interview up now and we'll be in contact shortly :-)

one can only dream of such efficient programming

Attached: wojak_feelius.jpg (512x512, 62K)

I think this one is my favourite.

{-# LANGUAGE GADTs #-}

module FizzBuzz where

import Data.Typeable

data Wrapper where
Wrap :: Typeable a => a -> Wrapper

instance Show Wrapper where
show (Wrap w) = case (cast w, cast w :: Maybe Int) of
(Just str, _) -> str
(_, Just int) -> show int
_ -> error "Type error"

fizz :: Wrapper -> Wrapper
fizz (Wrap w) = case cast w :: Maybe Int of
Just int | mod int 3 == 0 -> Wrap ("Fizz", int)
_ -> Wrap w

buzz :: Wrapper -> Wrapper
buzz (Wrap w) = case (cast w :: Maybe Int, cast w :: Maybe (String, Int)) of
(Just int, _) | mod int 5 == 0 -> Wrap "Buzz"
(_, Just (str, int)) | mod int 5 == 0 -> Wrap $ str ++ "Buzz"
| otherwise -> Wrap str
_ -> Wrap w

fizzbuzz :: [Int] -> [String]
fizzbuzz = map $ show . buzz . fizz . Wrap

main :: IO ()
main = mapM_ putStrLn $ fizzbuzz [1..100]

pls explain this magic
"Fizz"+4*!!(i%3)
"Buzz"+4*!!(i%5)