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
# coding: utf-8 | |
for i in range(1,31): | |
if i % 15 == 0: | |
print 'FizzBuzz' | |
elif i % 3 == 0: | |
print 'Fizz' | |
elif 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 num in 1..30 do | |
if num % 15 == 0 | |
puts "FizzBuzz" | |
elsif num % 5 == 0 | |
puts "Buzz" | |
elsif num % 3 == 0 | |
puts "Fizz" | |
else | |
puts num | |
end |
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 <= 30; i++) { | |
if (i % 3 == 0 && i % 5 == 0) | |
console.log("Fizz,Buzz"); | |
else if (i % 3 == 0) | |
console.log("Fizz"); | |
else if (i % 5 == 0) | |
console.log("Buzz"); | |
else // iが3の倍数でも5の倍数でもない | |
console.log(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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
for my $str (1..30) { | |
if ($str % 3 == 0 && $str % 5 ==0) { | |
print "fizzbuzz\n"; | |
} elsif ($str % 3 == 0) { | |
print "fizz\n"; | |
} elsif ($str % 5 == 0) { |