Last active
January 20, 2016 22:31
-
-
Save CasonBarnhill/dd86b9ef61c3573ef8d0 to your computer and use it in GitHub Desktop.
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 | |
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"; | |
} | |
} |
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
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