Created
February 12, 2017 10:32
-
-
Save kothiba/71f3e23d340572831a6e622ab849f7bb to your computer and use it in GitHub Desktop.
I wrote FizzBuzz in Perl
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) { | |
print "buzz\n"; | |
} else { | |
print "$str\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment