FizzBuzz

Post FizzBuzz in your language of choice

>"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."

OP:
class FizzBuzz
{
public static void main(String... c)
{
for(int i = 1; i < 101; i++)
{
System.out.println((i % 15 == 0) ? "FizzBuzz" :
((i % 3 == 0) ? "Buzz" :
((i % 5 == 0) ? "Fizz" : i)));
}
}
}

### 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))

for i in 1...100 {
if i % 15 == 0 {
print("FizzBuzz")
} else if i % 5 == 0 {
print("Buzz")
}else if i % 3 == 0 {
print("Fizz")
}
else {
print(i)
}
}

...

...

main = putStrLn (show (fb [1..100]))

fb:: (Show a, Integral a) => [a] -> [[Char]]
fb [] = []
fb (a:as)
| mod a 15 == 0 = "FizzBuzz" : fb as
| mod a 3 == 0 = "Fizz" : fb as
| mod a 5 == 0 = "Buzz" : fb as
| otherwise = (show a) : fb as


Just started learning haskell, how did I do

Here's my implementation in VB.NET

...

...

>uses >3 MB of memory
Perfect

OMG MATH.

for (int i = 1; i

(1..100).each do |number|
case
when number % 15 == 0 then puts 'FizzBuzz'
when number % 3 == 0 then puts 'Fizz'
when number % 5 == 0 then puts 'Buzz'
else puts number
end
end

Hi Pajeet!

...

...

fizzbuzz = sequence [putStrLn x | x

threes = {*range(3,100,3)}
fives = {*range(5,100,5)}

fizz = [[x,"fizz"] for x in threes - fives]
buzz = [[x,"buzz"] for x in fives - threes]
fizzbuzz = [[x,"fizzbuzz"] for x in fives & threes]
remainders = [[x,x] for x in {*range(100)} - threes - fives]

comp = fizz + buzz + fizzbuzz + remainders

print("\n".join((str(i) for _, i in sorted(comp))))

> }. (

...

...

...

wtf is this even
looks like some PLC graphical abomination

vimL
fu! Fizzbuzz()
let @q = "yyp\"
let @w = "0CFizz\3j"
let @e = "ABuzz\5j"
exe "norm! i1\99@q3G33@w5G20@e"
exe "norm! :%s/\\d*\\zeB\"
endf

import

Prograph. Found it in an abandonware repository. It's actually a pretty interesting language from the 90s.

Interesting.
Will have to read up more on that.

How do you guys have time to think of all these retarded ways?

#include

class FizzBuzz {

public:
FizzBuzz (int begin, int end);

bool operator () ();
void print (std::ostream &os) const;

private:
int _begin;
int _end;
int _current;
};

inline FizzBuzz::FizzBuzz (int begin, int end)
: _begin (begin)
, _end (end)
, _current (begin - 1) {}

inline bool FizzBuzz::operator () () {
return ++_current