Give your best fizzbuzz

give your best fizzbuzz

using System;

public class Program
{

public static void Main()
{
int i = 0;
int fizzbuzz = 100;
while(true){
if(i

Attached: download (1).jpg (234x215, 9K)

Other urls found in this thread:

pastebin.com/7zn4mVtB
github.com/Kikebook/fbos
twitter.com/NSFWRedditImage

for(int i = 1; i

3=fiss
5=buss
If divide by 3 or 5=fissbuss

Recursive Template Fizzbuzz lmao
auto fizzbuzz(uint N)() {
string accumulate;
return fizzbuzz!N(accumulate);
}

auto fizzbuzz(uint N)(ref string result) if (N % 3 && N % 5) {
import std.conv : to;

result ~= N.to!string ~ "\n";
return fizzbuzz!(N - 1)(result);
}

auto fizzbuzz(uint N)(ref string result) if (!(N % 15)) {
result ~= "FizzBuzz\n";
return fizzbuzz!(N - 1)(result);
}

auto fizzbuzz(uint N)(ref string result) if (!(N % 3) && N % 5) {
result ~= "Fizz\n";
return fizzbuzz!(N - 1)(result);
}

auto fizzbuzz(uint N)(ref string result) if (!(N % 5) && N % 3) {
result ~= "Buzz\n";
return fizzbuzz!(N - 1)(result);
}

auto fizzbuzz(uint N : 0)(ref string result) {
return result;
}

void main() {
import std.stdio : writeln;

fizzbuzz!50().writeln();
}

#include
#define BUZZZ int
#define FIZZZ printf
#define FIZZ for
#define BUZZ if
#define BZZ "\n"
#define FUZZ return
#define FIZZBUZZZ main
#define FIZZZBUZZ "%d"
#define FIZZBUZZ else
#define BUZZFIZZ 3
#define FIZZFIZZ 5
#define BUZZBUZZ 100

BUZZZ FIZZBUZZZ(){BUZZZ fizzbuzz;FIZZ(fizzbuzz=BUZZFIZZ/BUZZFIZZ;fizzbuzz

#include
using namespace std;

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

Jabaskibd :-DDd
let i = 0
while (i !== 101) {
let line = ''
if (!(i % 3))
line += 'fizz'
if (!(i % 5))
line += 'buzz'
if (!line.length)
line = i
console.log(line)
i++
}

pub fn main() {
let n = 100;
for i in 1..n+1 {
match (i % 3 == 0, i % 5 == 0) {
(true, true) => { println!("FizzBuzz"); },
(true, false) => { println!("Fizz"); },
(false, true) => { println!("Buzz"); },
(false, false) => { println!("{}", i) },
}
}
}

snek code
buffer = ""

for i in range(1,101):
if i%3 == 0:
buffer += "fizz"
if i%5 == 0:
buffer += "buzz"
if i%3 > 0 and i%5 > 0:
buffer += str(i)
print(buffer)
buffer = ""

#include

class printer {
public:
virtual void print (std::ostream &) const = 0;
};

static std::ostream &operator

You have a promising career as an enterprise software developer ahead of you. Try not to choke on the smell of curry.

class ZMW6bA3:
I7zbD6o=1084&2
AcKPFjz=4556 def __init__(wydwSk8,max):
wydwSk8.opiTjUi(19&13)
wydwSk8.WdGXGQW(max)
def opiTjUi(wydwSk8,QVXtxMv):
assert QVXtxMv>=12^12
wydwSk8.I7zbD6o=QVXtxMv
def d7Ojb02(wydwSk8):
return wydwSk8.I7zbD6o
def WdGXGQW(wydwSk8,QVXtxMv):
assert QVXtxMv>=682&341
wydwSk8.AcKPFjz=QVXtxMv
def lOxgiwl(wydwSk8):
return wydwSk8.AcKPFjz
def MdIFHvX(wydwSk8,QVXtxMv):
assert QVXtxMv>=121 wydwSk8.I7zbD6o+=QVXtxMv
def N6CpwSv(wydwSk8,QVXtxMv1,QVXtxMv2):
if QVXtxMv1==QVXtxMv2:
return ~-(11^9)
if QVXtxMv1>QVXtxMv2:
return (65535)+128 if QVXtxMv1>~-7:])
exit
def wE4FjAc(wydwSk8,HnEwwpj):
if wydwSk8.pU7T5H5(HnEwwpj):
print wydwSk8.F8E4H4Y
elif wydwSk8.XqOIBJY(HnEwwpj):
print wydwSk8.T2QsU3T
elif wydwSk8.qRNYr03(HnEwwpj):
print wydwSk8.byTIMLE
else:
print str(HnEwwpj)

def Oy7nSmy(wydwSk8):
while wydwSk8.Q44FnPy.I7zbD6o < wydwSk8.Q44FnPy.AcKPFjz:
wydwSk8.T2QsU3TbyTIMLEorF8E4H4Y()

wE4FjAcer(((1567)+(4)*(17^18)))

im still learning :) dont hate on me :o
4channel won't let me post my code here (is moot transphobic or smth?) so i put it on pastebin :D
pastebin.com/7zn4mVtB

Don't worry, I can handle myself through deep and smart code (like in my example).

this fizzbuzzes 1-100

OP here fuckers, here's the improved one.

using System;

public class Program{
public static void Main(){
int i = 0;
int fizzbuzz = 16;

for (i = 1; i

wait i'm a tard, why is buffer in there twice

i = 0
while i < 101:
buffer = ""
if i%3 == 0:
buffer = "fizz"
if i%5 == 0:
buffer += "buzz"
if buffer == "":
buffer = str(i)
print(buffer)
i += 1

congratulations, I would like to offer you a job at Dimitry Prosenko's Malware Inc

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

Best solution posted so far.

def fb(i=100) -> str:
return f"{fb(i-1) if i-1 > 0 else ''} {'fizz' if i % 3 == 0 else ''}{'buzz' if i % 5 == 0 else ''}{i if i % 3 != 0 and i % 5 != 0 else ''}"

Sorry user your code is too confusing to follow. We dont think you would be a good addition to the team

here's an elixir fizzbuzz.

Enum.map(1..100, fn i ->
cond do
rem(i, 3) == 0 and rem(i, 5) == 0 -> IO.puts "fizzbuzz"
rem(i, 3) == 0 -> IO.puts "fizz"
rem(i, 5) == 0 -> IO.puts "buzz"
true -> IO.puts i
end
end)

const fzbz = require('fizzbuzz')
fzbz.fizzbuzz()

Attached: 1541280455827.jpg (466x659, 34K)

for(int i = 1; i

interface FizzBuzzable {
public int value();
public String doFizzBuzz();
}
final class FizzBuzzableNumber implements FizzBuzzable {
private final int num;
public FizzBuzzableNumber(int n) { this.num = n; }
public final int value() { return this.num; }
public final String doFizzBuzz() { return new Integer(this.num).toString(); }
}
abstract class DivisibleNumber implements FizzBuzzable {
protected final FizzBuzzable original;
public DivisibleNumber(FizzBuzzable origin) { this.original = origin; }
public final int value() { return this.original.value(); }
public final String doFizzBuzz() {
String fizzBuzzed;
if (this.isDivisible())
fizzBuzzed = this.fizzBuzzing();
else
fizzBuzzed = this.original.doFizzBuzz();
return fizzBuzzed;
}
protected abstract boolean isDivisible();
protected abstract String fizzBuzzing();
}
final class NumberDivisibleByThree extends DivisibleNumber {
public NumberDivisibleByThree(FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Fizz"; }
protected final boolean isDivisible() { return ((this.value() % 3) == 0); }
}
final class NumberDivisibleByFive extends DivisibleNumber {
public NumberDivisibleByFive(FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Buzz"; }
protected final boolean isDivisible() { return ((this.value() % 5) == 0); }
}
final class NumberDivisibleByThreeAndFive extends DivisibleNumber {
public NumberDivisibleByThreeAndFive (FizzBuzzable origin) { super(origin); }
protected final String fizzBuzzing() { return "Fizz Buzz"; }
protected final boolean isDivisible() { return ((this.value() % 15) == 0); }
}

public class Main {
public static void main(String[] args) {
for (int i = 1; i

clever

open System

let fizzBuzz x =
match x with
| _ when x % 15 = 0 -> "FizzBuzz"
| _ when x % 5 = 0 -> "Buzz"
| _ when x % 3 = 0 -> "Fizz"
| x -> Convert.ToString x

[]
let main argv =
[1..100]
|> List.map(fun x -> printfn "%s" (fizzBuzz x))
|> ignore
0

idk

#!/usr/bin/env python
import fizzbuzz
choice = raw_input("You want to run fizzbuzz? ")
if(choice == "y") { print(fizzbuzz.start()) }
if(choice == "n") { print(fizzbuzz.start()) }

import fizzbuzz

for num in range(1,101):
string = ""
if num % 3 == 0:
string = string + "Fizz"
if num % 5 == 0:
string = string + "Buzz"

print(string)

for(int i = 1; i

why is that better than printing each time?

p{counter-increment:f}p:not(:nth-of-type(5n)):before{content:counter(f)}p:nth-of-type(3n):before{content:"Fizz"}p:nth-of-type(5n):after{content:"Buzz"

Don't need a separate if for i%3==0 && i%5==0 that way

static const char * fbi[] = {"%i\n", "fizz\n", "buzz\n", "fizzbuzz\n"};
for(int i = 1; i

fizzbuzzed = [
"1", "2", "Fizz", "4", "Buzz",
"Fizz", "7", "8", "Fizz", "Buzz",
"11", "Fizz", "13", "14", "Fizzbuzz"
]
final = 100
i = 0
while i < final:
try:
print(str(int(fizzbuzzed[i % 15]))[0:0] + str(int(i+1)))
except:
print(fizzbuzzed[i%15])
i += 1

In python this is just
("FizzBuzz"[i*i%3*4:8--i**4%5] or i for i in range(1,101))
That's just the generator, print it however you like.

class NASAFizzBuzz
{
static void print(T t)
{
Console.WriteLine(t.ToString());
}
static bool isDiv3(int i)
{
var c = i.ToString().ToCharArray();
int sum = 0;
foreach(var v in c)
{
sum += int.Parse(v.ToString());
}
for(int j = 0; j < 2147483647; j+=3)
{
if (sum == j)
return true;
}
return false;
}
static bool isDiv5(int i)
{
var c = i.ToString().ToCharArray();
int sum = int.Parse(c[c.Count() - 1].ToString());
for (int j = 0; j < 2147483647; j += 5)
{
if (sum == j)
return true;
}
return false;
}
static void Main(string[] args)
{
for(int i = 0; i < 100; i++)
{
if (isDiv3(i) && isDiv5(i))
print("fizzbuzz");
else if (isDiv3(i))
print("fizz");
else if (isDiv5(i))
print("buzz");
else
print(i);
}
}
}

What causes the or i section to trigger?

>best fizzbuzz
Yes it is.
for i in range(1, 101):
if i % 3 == 0:
if i % 5 == 0:
print("fizzbuzz")
else:
print("fizz")
elif i % 5 == 0:
print("buzz")
else:
print(i)

Number two prints line numbers, fizzbutt is a feature.
for i in range(1, 101):
s = str(i) + " "
if i % 3 == 0:
s += "fizz"
if i % 5 == 0:
s += "butt"
print(s)

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

Sufficiently advanced java is indistinguishable from satire.

I once wrote fizzbuzz with recursion at the interview in firefox console and forget to terminate recursion when 100 reached. Firefox hanged up, ubuntu hanged up, only system restart helped. They didn't hire me)))

I'm not a programmer and looking at these I'm wondering, is it annoying having to type all these special symbols in exact format?

Is there some shortcuts to use or are you typing everything out as I see it?

Or over time does it just become as natural as it is for me typing english?

Also, given that all of them seem to differ in format slightly how do you determine what language it is?

function fizzbuzz()
print("fizzbuzz is gay go away")
end

dumbass. you could have at least known how to swap to a new tty and kill it.

>("FizzBuzz"[i*i%3*4:8--i**4%5] or i for i in range(1,101))
it doesn't user fucked it up

That's interesting.

Not a programmer either, you have to type them out and it becomes natural. While I can follow all the examples posted I don't recognize all the languages.

for i=1,100 do
fizz = i%3 == 0
if fizz then
io.write('fizz')
end
if i%5 == 0 then
io.write('buzz')
elseif not fizz then
io.write(i)
end
print()
end

You have no problem remembering the rules of English grammar though. Or most of it at least, enough to write coherently in English. That requires learning the rules for lots of arbitrary punctuation and formatting. Once you know what all the symbols mean you can follow what the code is doing, no different than parsing English sentences.

Not really sure about your last question. Aren't obvious differences the usual way you distinguish between languages? If I type
>Good day sir, how are you?
and
>お前は好きだ。私の妹をやるために私の家にお前を連れて来たい。
You can easily tell which one is English and which one isn't.

namespace fizzbuzzingabout
{
class Program
{
static void Main(string[] args)
{
int number =0;
while (number

Here I made a second lisp recursive one
(defun fizzbuzz (x y)
(if (and (not (= (mod x 3) 0)) (not (= (mod x 5) 0))) (format t "~S" x))
(if (= (mod x 3) 0) (format t "Fizz"))
(if (= (mod x 5) 0) (format t "Buzz"))
(format t "~%")
(if (< x y) (fizzbuzz (+ x 1) y)))
(fizzbuzz 1 100)

>is it annoying having to type all these special symbols in exact format?
Not anymore then I get tried of remembering and writing out + and - symbols when taking notes for math class.
>Is there some shortcuts to use or are you typing everything out as I see it?
Some IDEs help you find method names and stuff but I don't use any thing to help me besides the documentation and internet.
>Also, given that all of them seem to differ in format slightly how do you determine what language it is?
By the looking at those differences? duh? If something has a bunch of parenthesis then it is a lisp dialect, if something has a bunch of verbose public final abstract spaghetti factory garbage it is java. If it has no brackets, no semicolons, no end keyword, and starts loops/functions with : then it's python. If it has #include it's C++ and if it has #include it's C.

i=0
f=[1,2,"Fizz",4,"Buzz","Fizz",7,8,"Fizz","Buzz",11,"Fizz",13,14,"FizzBuzz"]
while i

Alternatively
>Following Python's forced syntax rules
[print(([1,2,"Fizz",4,"Buzz","Fizz",7,8,"Fizz","Buzz",11,"Fizz",13,14,"FizzBuzz"][i%15])+15*(int(i/15)) if (type([1,2,"Fizz",4,"Buzz","Fizz",7,8,"Fizz","Buzz",11,"Fizz",13,14,"FizzBuzz"][i%15])==int) else [1,2,"Fizz",4,"Buzz","Fizz",7,8,"Fizz","Buzz",11,"Fizz",13,14,"FizzBuzz"][i%15]) for i in range(0,160,1)]

I'm stealing this for my next job interview.

for(var i = 0; i

let rec range a b =
if a > b then []
else a :: range (a+1) b

let fizzbuzz x =
match (x mod 15) with
0 -> "FizzBuzz"
| 3 -> "Fizz"
| 5 -> "Buzz"
| 6 -> "Fizz"
| 9 -> "Fizz"
| 10 -> "Buzz"
| _ -> string_of_int x

let () =
List.iter (fun x -> (Printf.printf "%s\n" (fizzbuzz x))) (range 1 100)

I remember Jow Forums memeing fizzbuzz real hard a few years ago. And this is why none of you fuckers have jobs.

The original specification called for a range to and including 100. You've failed this interview and now security will escort you off the property. Send in the next candidate, Mr Balsdip Preetpal

Attached: boss.jpg (201x211, 9K)

$pip search fizzbuzz
...
...
fuck my ass it's real

Oops, response to

We still do

Attached: memeit.jpg (480x434, 14K)

How can i improve this to be less verbose?
Array.from(
Array(100),
(_, i) =>
[!(++i % 5) && 'fizz', !(i % 3) && 'buzz'].filter(Boolean).join(' ') || i,
).join(' ');

omg OCaml so shitty verbose language, thought this post is a joke, googled fizzbuzz in OCaml and it even verse. Why facebook is pushing this shit to masses?

It's correct, the empty string is considered false in python.

pick a different language

github.com/Kikebook/fbos

I know only js(

fn fizz_buzz(range: uint64) {
for i in 0..range {
match (i%5, i %3) {
(0,0) => println!("fizzbuzz"),
(_,0) => println!("fizz"),
(0,_) => println!("buzz"),
}
}
}

>hes not using rust
lmao at your life

is this rust?

can't you tell by how retarded it looks

Also only this solution seems to be no verbose.
But it prints FizzBuzz and not Fizz Buzz

Maybe F#, but I'm not sure.

well ive been using rust for a few weeks now and the syntax looks very similar to rust but im not sure it is since ive never seen rust code look anything like that

entrypoint is an f# thing

Finally done this in OCaml
let fizzbuzz () =
let rec aux i =
let head = if i = 1 then "" else " " in
let c = match (i mod 5, i mod 3) with
| (0, 0) -> head ^ "Fizz Buzz"
| (_, 0) -> head ^ "Fizz"
| (0, _) -> head ^ "Buzz"
| _ -> head ^ string_of_int i
in if i = 100 then c else c ^ aux (i + 1)
in aux 1;;

but desu i like my js solution much more. Maybe I've done it wrong and there is a better way?

Don't run this code it makes mustard gas

>wE4FjAc(wydwSk8,HnEwwpj):
> if wydwSk8.pU7T5H5(HnEwwpj):
> print wydwSk8.F8E4H4Y
> elif wydwSk8.XqOIBJY(HnEwwpj):
> print wydwSk8.T2QsU3T
> elif wydwSk8.qRNYr03(HnEwwpj):
> print wydwSk8.byTIMLE
> else:
> print str(HnEwwpj)

>using the untermensch %15 %5 %3 comparison

was meant for

wouldn't it make it harder if you wanted to change "fizzbuzz" to "bumhole" every multiple of both while retaining "fizz" + "buzz" for 3 and 5 respectively?

char * fizzbuzz(char *buzz, char *fizz){
if(strlen(fizz) > strlen(buzz) ){
return fizz+= buzz;
}
fizzbuzz(buzz, fizz);

Attached: 1534768754262.png (1280x720, 589K)

Fastest I could make

#define _GNU_SOURCE
#include
#include
#include
#include

/* COPY PASTED STOPWATCH CODE FROM STACKEXCHANGE */
double PCFreq = 0.0;
__int64 CounterStart = 0;

void StartCounter()
{
LARGE_INTEGER li;
if(!QueryPerformanceFrequency(&li)){
printf("QueryPerformanceFrequency failed!\n");}

PCFreq = (double) (li.QuadPart); // Seconds

QueryPerformanceCounter(&li);
CounterStart = li.QuadPart;
}
double GetCounter()
{
LARGE_INTEGER li;
QueryPerformanceCounter(&li);
return (double)(li.QuadPart-CounterStart)/PCFreq;
}

int main(int argc, char *argv[2]){
unsigned long long a = atoi(argv[1]);

double tf;
StartCounter();
// Setting up format
unsigned long long i = 1;
const char *fmts[] = {"%%d ", "Fizz ", "Buzz ", "FizzBuzz "};
char *pattern[15];
asprintf(&pattern[0],fmts[3]);
for(i; i < 15; i++){
if(i % 3 == 0 ){ asprintf(&pattern[i], fmts[1]); }
else if (i % 5 == 0 ){ asprintf(&pattern[i], fmts[2]); }
else { asprintf(&pattern[i], fmts[0]); }
}

// Prints
for(i = 0; i < a+1; i++){
//printf(pattern[i % 15],i);
i % 15;
}
tf = GetCounter();
printf("\nTime = %lfs",tf);

return 0;
}

Attached: Untitled.png (1045x539, 40K)

And now extend your code to print Nuzz if a the number is divisible by 653204 and Mazz if it is divisible by 953287 whilst upholding the concatenation rule (eg. FizzBuzzNuzzMazz)

cancer

you are like a little baby
watch this
#include

#include
#include
#include

template struct overloaded : Ts... { using Ts::operator()...; };

enum fizzbuzz_t {
fizz,
buzz,
fizzbuzz,
};

std::ostream& operator

>using module in a loop for something that otherwise doesn't require integer division

Attached: 1543378682807.png (842x792, 82K)

cd ..
cd kode
cd ..
pwd
cd kode
echo "1,2,fizz,4,5,6,8,fizz,10,11,12,13,14,15,fizzbuzz,17"

U0 FizzBuzz () {
I64 i;
U8 c=0;
for(i=0; i 0) {
"%d", i;
}
"\n";
c=0;
}
}

Forgot, need to actually execute it
FizzBuzz;

Should be c==0, fuck

for i in {1..100}; do
s=
(( i % 3 )) || s+=fizz
(( i % 5 )) || s+=buzz
echo ${s:-$i}
done

for(i=1; i

Attached: 1542294003765.png (332x332, 148K)

Ignore the bool l