Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FizzBuzz
<?php
for($i=0;$i<=100;$i++){
if($i % 3 ==0 && $i % 5 == 0){
echo "FizzBuzz\n";
continue;
}
if($i % 3 ==0){
echo "Fizz\n";
continue;
}
if($i % 5 ==0){
echo "Buzz\n";
continue;
}
echo $i,"\n";
}
?>
for i in range(1,101):
if(i % 5 == 0 and i % 3 ==0):
print "FizzBuzz"
continue
if(i % 5 == 0):
print "Buzz"
continue
if(i % 3 == 0):
print "Fizz"
continue
print i
(1..100).each do |i|
if(i %5 == 0 && i % 3 == 0)
p "FizzBuzz"
next
end
if(i % 5 == 0)
p "Buzz"
next
end
if(i % 3 == 0)
p "Fizz"
next
end
p i
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment