Write a program that prints all the numbers from 1 to 100.
- For multiples of 3, instead of the number, print "Fizz"
- For multiples of 5 print "Buzz" .
- For numbers which are multiples of both 3 and 5, print "FizzBuzz".
But here's the catch: you can use only one if
. No multiple branches, ternary
operators or else
.
- Maximum of 1
if
- You can't use
else
,else if
or ternary - You can't use switch ... case
- Unit tests
- You have to use PHP.