Last active
December 17, 2015 20:58
-
-
Save dmpeters/5671045 to your computer and use it in GitHub Desktop.
codersumo fizzbuzz in several languages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i=1; i<=100; i++){ | |
if (i % 15 == 0) { | |
print('FizzBuzz'); | |
} | |
else if (i % 5 == 0) { | |
print('Buzz'); | |
} | |
else if (i % 3 == 0) { | |
print('Fizz'); | |
} | |
else { | |
print(i); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
for ($i = 1; $i <= 100; $i++) { | |
if ( $i%15 == 0 ) { | |
print "FizzBuzz"; | |
} elseif ( $i%3 == 0 ) { | |
print "Fizz"; | |
} elseif ( $i%5 == 0 ) { | |
print "Buzz"; | |
} else { | |
print $i; | |
} | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ($i = 1; $i <= 100; $i++) { | |
if ( $i%15 == 0 ) { | |
print "FizzBuzz"; | |
} elsif ( $i%3 == 0 ) { | |
print "Fizz"; | |
} elsif ( $i%5 == 0 ) { | |
print "Buzz"; | |
} else { | |
print $i; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for x in range(1, 101): | |
if x%15 == 0: | |
print "FizzBuzz" | |
elif x%3 == 0: | |
print "Fizz" | |
elif x%5 == 0: | |
print "Buzz" | |
else: | |
print x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1..100).each do |i| | |
if i % 15 == 0 | |
puts "FizzBuzz" | |
elsif i % 3 == 0 | |
puts "Fizz" | |
elsif i % 5 == 0 | |
puts "Buzz" | |
else | |
puts i | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment