How hard is FizzBuzz? [closed]
- by Josh K
After reading various blog entries I took it upon myself to code a FizzBuzz program in PHP.
class FizzBuzz
{
function __construct()
{
}
function go()
{
for($i = 1; $i < 101; $i++)
{
if($i % 3 == 0 and $i % 5 == 0)
{
echo("FizzBuzz\n");
continue;
}
else if($i % 3 == 0)
{
echo("Fizz\n");
continue;
}
else if($i % 5 == 0)
{
echo("Buzz\n");
continue;
}
else
{
echo($i."\n");
}
}
}
}
$FB = new FizzBuzz();
$FB->go();
Created the FizzBuzz object just because I could, I complete this in under five minutes.
Is it really that hard to do?