FizzBuzz Solution Dumping Ground
One solution in Erlang with recursion. -module(fizzbuzz). -export([print/0]). print() -> FizzBuzzList = eval(100, []), lists:foreach(fun(Item)->io:format("~p~n", [Item]) end, FizzBuzzList)....
View ArticleFizzBuzz Solution Dumping Ground
Old but gold, vb6: Dim i As Integer Open "C:\output.txt" For Append As #1 ' VB6 does not have native console window support For i=1 To 100 If i Mod 3 = 0 Then Print #1, "Fizz" If i Mod 5 = 0 Then...
View ArticleFizzBuzz Solution Dumping Ground
My 2 cents in Perl. Not the shortest, but it is among the most compact and still readable, doesn’t cheat using a module that does the work and is not exposed, and most importantly, it works CORRECTLY...
View ArticleFizzBuzz Solution Dumping Ground
This one is simpler, more readable, and no ternary ops: while ($i++ < 100){ my $out; $out = "Fizz" unless ($i%3); $out .= "Buzz" unless ($i%5); say "$out" || "$i"; } # ... and oh, it works...
View ArticleFizzBuzz Solution Dumping Ground
Of course we couldn’t forget our both loved and hated VBA in all its glory Normal Loop: Sub FizzBuzz(n As Integer) Dim i As Integer For i = 1 To n If i Mod 3 = 0 And i Mod 5 = 0 Then Debug.Print...
View ArticleFizzBuzz Solution Dumping Ground
Matt_Giuca: Uh, someone ordered an x86 assembly version? Now imagine that poor soul that made Roller Coaster 2, ALL in assembly… Read full topic
View ArticleFizzBuzz Solution Dumping Ground
Let’s go python: def FizzBuzz(highestNumber, numbers, words): for i in range(1, highestNumber + 1): out = "" for number, word in zip(numbers, words): if i % number == 0: out += word print(out if out...
View ArticleFizzBuzz Solution Dumping Ground
Python, could be more compact but this way it is more clear what the program does and less computation only mod two times instead of four. for i in range(0,101): fizz = i % 5 == 0 buzz = i % 3 == 0 if...
View ArticleFizzBuzz Solution Dumping Ground
In java, but in functional paradigm (don’t do this at work). public static void main(String[] args) { final String result = IntStream .rangeClosed(1, 100) .mapToObj(Scratch::fizzBuzz)...
View ArticleFizzBuzz Solution Dumping Ground
And since no one seems to have picked MUMPS in thirteen years of responses: F I=1:1:100 W !,$S(I#15=0:"Fizzbuzz",I%3=0:"Fizz",I%5=0:"Buzz",1:I) Read full topic
View ArticleFizzBuzz Solution Dumping Ground
Surprised no one posted this efficient solution so far. I’ll post it in PHP I guess, but the concept works in most languages. function FizzBuzz($limit = 100, $FizzMultiple=3, $BuzzMultiple=5){...
View ArticleFizzBuzz Solution Dumping Ground
Well I read the article and knew I had to dump my JS solution for it var i; for (i = 1; i < 101; i++) { if((i%3==0) && (i%5==0)) { console.log("FizzBuzz"); } else if(i%3==0) {...
View ArticleFizzBuzz Solution Dumping Ground
I tried this simple code for number in range(101): if number%15 == 0 : print("FizzBuzz") elif number%5 == 0: print("Buzz") elif number%3 == 0: print("Fizz") else: print(number) Read full topic
View ArticleFizzBuzz Solution Dumping Ground
Surprised nobody has posted this here yet… Coding in Stenography, Quick Demo Read full topic
View ArticleFizzBuzz Solution Dumping Ground
for num in range(1,100): if num % 3 == 0: print("Fizz", num) elif num % 5 == 0: print("Buzz", num) elif num % 3 == 0 and num % 5 == 0: print("FizzBuzz", num) elif num % 1 == 0: print("Prime", num)...
View ArticleFizzBuzz Solution Dumping Ground
Thank you for liking my code. I also wrote two different paper, scissors, rock program but was difficult at the start and abstract but I put mind to work and think and think with music. I am a...
View ArticleFizzBuzz Solution Dumping Ground
Java Solution class Main { public static void main(String[] args) { int i = 0; while (i != 101) { if ((i % 3 == 0)&(i % 5 != 0)){ System.out.println("Fizz"); } else if ((i % 3 != 0)&(i % 5 ==...
View ArticleFizzBuzz Solution Dumping Ground
Many have done it, now it’s my turn… <?php for ($i=1; $i<=100; $i++) { $string = ''; $string = $i%3==0 ? $string.'Fizz' : $string; $string = $i%5==0 ? $string.'Buzz' : $string; $string = $string...
View ArticleFizzBuzz Solution Dumping Ground
Someone decided (in a fit of self mutilation) to optimize fizzbuzz using assembly: fastest code - High throughput Fizz Buzz - Code Golf Stack Exchange Read full topic
View ArticleFizzBuzz Solution Dumping Ground
A late entry for GameMaker, with something they call ‘commenting’ and some ‘color’. Could be made more efficient but I was going for speed and clarity: //DRAW STEP var pos_x = 20; var pos_y = 5; var...
View Article
More Pages to Explore .....