Skip to content

Instantly share code, notes, and snippets.

@CasonBarnhill
Last active January 20, 2016 22:31
Show Gist options
  • Save CasonBarnhill/dd86b9ef61c3573ef8d0 to your computer and use it in GitHub Desktop.
Save CasonBarnhill/dd86b9ef61c3573ef8d0 to your computer and use it in GitHub Desktop.
<?php
for ($i = 1; $i <= 20; $i++)
{
if($i % 3 == 0 && $i % 5 ==0){
echo "WhizzBang\n";
}
else if($i % 3 == 0){
echo "Whizz\n";
}
else if($i % 5 == 0){
echo "Bang\n";
}
else {
echo $i."\n";
}
}
static void Main()
{
for (int n = 1; n <= 20; n++)
{
if (n % 15 == 0)
{
Console.WriteLine("WhizzBang");
}
else if (n % 3 == 0)
{
Console.WriteLine("Whizz");
}
else if (n % 5 == 0)
{
Console.WriteLine("Bang");
}
else
{
Console.WriteLine(n);
}
}
// Prevents program from exiting
Console.ReadLine();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment