Fizzbuzz

Write fizzbuzz in your prefered language, just make sure its as short as possible and in single line. Here is c# fizzbuzz

>Enumerable.Range(1, 30).ToList().ForEach(i => { if(i % 15 == 0) Console.WriteLine("fizzbuzz"); else if (i % 5 == 0) Console.WriteLine("fizz"); else if (i % 3 == 0) Console.WriteLine("buzz"); else Console.WriteLine(i); });

Attached: fizzbuzz.png (1177x557, 130K)

Other urls found in this thread:

github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
twitter.com/NSFWRedditGif

Enumerable
.Range(1, 30)
.ToList()
.ForEach(i =>
{
if(i % 15 == 0)
Console.WriteLine("fizzbuzz");
else if (i % 5 == 0)
Console.WriteLine("fizz");
else if (i % 3 == 0)
Console.WriteLine("buzz");
else Console.WriteLine(i);
});

Let me format it for you.

Enumerable
.Range(1, 100)
.Select(n =>
(n % 15 == 0) ? "FizzBuzz" :
(n % 3 == 0) ? "Fizz" :
(n % 5 == 0) ? "Buzz" :
n.ToString())
.ToList()
.ForEach(Console.WriteLine);

From code golf in SO.

Lets roll:

print(['fizzbuzz' if x % 15 == 0 else 'fizz' if x % 3 == 0 else 'buzz' if x % 5 == 0 else x for x in range(1, 100)])

print('1 2 fizz 4 buzz fizz 7 8 fizz buzz 11 fizz 13 14 fizzbuzz')

fucking python

A[I]←1+I←(0⍷A)/⍳⍴A←('FIZZBUZZ' 'FIZZ’ 'BUZZ' 0)[2⊥¨×(⊂3 5)|¨1+⍳100]

git clone github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition

55*4*v _ v
v :1-:^
|:0"zzif">:#,_$ v
>:3%!| >0"zzub">:#,_$^
>:5%!|
v "buzz"0:. ^
|!%5: <
>:#,_ $> ^

: .fizzbuzz ( n -- )
0 pad c!
dup 3 mod 0= if s" Fizz" pad place then
dup 5 mod 0= if s" Buzz" pad +place then
pad c@ if drop pad count type else . then ;

: zz ( n -- )
1+ 1 do i .fizzbuzz cr loop ;
100 zz

what the fuck?

1..100|%{(($t="Fizz"*!($_%3)+"Buzz"*!($_%5)),$_)

fizzBuzz :: Int -> String
fizzBuzz 101 = []
fizzBuzz (x:xs)
|mod x 15 == 0 = "FizzBuzz " ++ fizzBuzz xs
|mod x 5 == 0 = "Buzz " ++ fizzBuzz xs
|mod x 3 == 0 = "Fizz " ++ fizzBuzz xs
|otherwise = show x ++ fizzBuzz xs


fizzBuzz 1

(defun fizzbuzz (n &optional (i 1))
(cond ((equal i n) (fizzbuzz-aux n))
(t
(print (fizzbuzz-aux i))
(fizzbuzz n (+ i 1)))))

(defun fizzbuzz-aux (n)
(cond ((zerop (mod n 15)) "FizzBuzz")
((zerop (mod n 3)) "Fizz")
((zerop (mod n 5)) "Buzz")
(t n)))

My language is superior to yours:
Start counting from one and up:
For numbers divisible by both three and five print "FizzBuzz" otherwise
if it's divisible by three print "Fizz" otherwise
if it's divisble by five print "Buzz" otherwise
print the current number.

Seems like a shit language. What is it

English

>using a shit language to call it a shit language

Attached: 056429857310.gif (500x281, 231K)

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

.data
fiz: .asciiz "Fizz"
buz: .asciiz "Buzz"
nl: .asciiz "\n"
.text
main:
li $t0, 1
li $t7 101
li $t3 3
li $t5 5
li $t4 1
li $v0 4

Loop: beq $t0 $t7 End
div $t0 $t3
mfhi $t2
beqz $t2 Fizz

N1: div $t0 $t5
mfhi $t2
beqz $t2 Buzz

N2: beqz $t4 N3
li $v0 1
move $a0 $t0
syscall
li $v0 4

N3: addi $t0 $t0 1
la $a0 nl
syscall
li $t4 1
j Loop

Fizz:
la $a0 fiz
syscall
li $t4 0
j N1
Buzz:
la $a0 buz
syscall
li $t4 0
j N2
End:
li $v0 10
syscall

Attached: diogenesnavipeperev2.jpg (1024x752, 200K)

div5(X) :- 0 is X mod 5.
div3(X) :- 0 is X mod 3.

fizzbuzz(X, Max) :- (div3(X), div5(X), writeln('FizzBuzz');
div5(X), writeln('Buzz');
div3(X), writeln('Fizz');
writeln(X)), !,
X < Max,
X1 is X+1,
fizzbuzz(X1, Max).

fizzbuzz :- fizzbuzz(1, 100).

>Reinventing the wheel
>Having a non-zero length program
Please.

perl -MAcme::FizzBuzz -e ""

What lang is this

>everyone ignores OP's direction to make it one line

for(int i=1;i

befunge

thats because op is a faggot

Powershell fizzbuzz :)

foreach ($i in 1..$args[0])
{
$fizzarray = @($i,"fizz","buzz","fizzbuzz")
$o = 0
if ($i % 3 -eq 0) {$o += 1}
if ($i % 5 -eq 0) {$o += 2}
$fizzarray[$o]
}