Skip to content

Instantly share code, notes, and snippets.

@masterfermin02
Created December 7, 2018 17:34
Show Gist options
  • Save masterfermin02/469e80c7ad59b49184230ed5c98e9c17 to your computer and use it in GitHub Desktop.
Save masterfermin02/469e80c7ad59b49184230ed5c98e9c17 to your computer and use it in GitHub Desktop.
function print_numbers()
{
for(var i = 1; i <= 200; i++)
{
var str = "";
if(i % 3 == 0)
{
str = " Blue";
}
if(i % 5 == 0)
{
str += " Red";
}
console.log(i + str);
}
}
function print_numbers(number)
{
if(number < 1) return;
var str = "";
if(number % 3 == 0) str = "Blue";
if(number % 5 == 0) str += "Red";
print_numbers(number - 1);
console.log(number +" "+ str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment