Created
February 23, 2016 14:35
-
-
Save ken-master/785fcf40c54d199b4583 to your computer and use it in GitHub Desktop.
Fuzz,Buzz & Woof
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 | |
function solution($N) { | |
//asuming $N is a range of numbers integr | |
for ($i = 1; $i <= $N; $i++){ | |
if( $i%3 == 0 && $i%5 == 0 && $i%7 == 0 ){ | |
echo "FizzBuzzWoof\n"; | |
}elseif( $i%3 == 0 && $i%5 == 0){ | |
echo "FizzBuzz\n"; | |
}elseif($i%3 == 0 && $i%7 == 0){ | |
echo "FizzWoof\n"; | |
}elseif($i%5 == 0 && $i%7 == 0){ | |
echo "BuzzWoof\n"; | |
}elseif($i%3 == 0 ){ | |
echo "Fizz\n"; | |
}elseif($i%5 == 0){ | |
echo "Buzz\n"; | |
}elseif($i%7 == 0){ | |
echo "Woof\n"; | |
}else{ | |
echo $i."\n"; | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment