FizzBuzz Solution Dumping Ground


#289

Here’s a PHP solution that actually works :slight_smile:

$x=1;

while ($x<=100)
{
if ($x%3==0 and $x%5==0)
{
print "<p>\tfizzbuzz</p>\n";
}
elseif ($x%3==0)
{
print "<p>\tfizz</p>\n";
}
elseif ($x%5==0)
{
print "<p>\tbuzz"."</p>\n";
}
else
{
print "<p>$x</p>\n";
}

$x++;
}

#290

I see no continue being used.

for (int i = 1; i <= 100; i++)
        {
            if (i % 3 == 0 && i % 5 == 0)
            {
                Console.WriteLine("Fizz-Buzz {0}", i);
                continue;
            }
            if (i % 3 == 0 && i % 5 != 0)
            {
                Console.WriteLine("Fizz {0}", i);
                continue;
            }
            if (i % 3 != 0 && i % 5 == 0)
            {
                Console.WriteLine("Buzz {0}", i);
               continue;
            }
            Console.WriteLine(i);
        }