>"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))); } } }
### Target ### .PHONY: all all: ; $(info $(fizzbuzz))
Jaxson Powell
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) } }
Ayden Russell
...
Jackson Lewis
...
John Flores
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
Christian Allen
Here's my implementation in VB.NET
Gavin Green
...
Easton Bennett
...
Nathan Ramirez
>uses >3 MB of memory Perfect
Isaiah Stewart
OMG MATH.
Robert Price
for (int i = 1; i
Camden Gonzalez
(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
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))))
John Turner
> }. (
Asher Gonzalez
...
Logan Watson
...
Carter Rivera
...
Benjamin Morris
wtf is this even looks like some PLC graphical abomination
Ryan Wright
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
Christopher Brown
import
Brody Harris
Prograph. Found it in an abandonware repository. It's actually a pretty interesting language from the 90s.
Aaron Martin
Interesting. Will have to read up more on that.
Juan Anderson
How do you guys have time to think of all these retarded ways?