Created
November 9, 2018 01:51
-
-
Save AminBusiness/f9010e7e5793153b1bfa1599594c4f4a to your computer and use it in GitHub Desktop.
// source https://jsbin.com/gavovuh
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
<script id="jsbin-javascript"> | |
//Challenge 6: FIZZBUZZ | |
//Write a program that prints all of the numbers from 1 to 11 in multiples of 3, | |
//instead of the number, print "fizz", for multiples of 5 print "buzz", for numbers | |
//Which are mutiples ofboth 3 and 5, print "Fizzbuzz". | |
function fizzbuzz() | |
{ | |
//Loops through 1 - 100 | |
for(let i = 1; i <= 100; i++) | |
{ | |
if(i % 3 === 0 && i % 5 === 0) | |
{ | |
console.log('FizzBuzz') | |
} | |
//If there is a remainder of 3 | |
else if(i % 3 === 0) { | |
console.log('Fizz') | |
} else if(i % 5 === 0) | |
{ | |
console.log('FizzBuzz') | |
} | |
else | |
{ | |
console.log(i); | |
} | |
} | |
} | |
const output = fizzbuzz('') | |
console.log(output); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">//Challenge 6: FIZZBUZZ | |
//Write a program that prints all of the numbers from 1 to 11 in multiples of 3, | |
//instead of the number, print "fizz", for multiples of 5 print "buzz", for numbers | |
//Which are mutiples ofboth 3 and 5, print "Fizzbuzz". | |
function fizzbuzz() | |
{ | |
//Loops through 1 - 100 | |
for(let i = 1; i <= 100; i++) | |
{ | |
if(i % 3 === 0 && i % 5 === 0) | |
{ | |
console.log('FizzBuzz') | |
} | |
//If there is a remainder of 3 | |
else if(i % 3 === 0) { | |
console.log('Fizz') | |
} else if(i % 5 === 0) | |
{ | |
console.log('FizzBuzz') | |
} | |
else | |
{ | |
console.log(i); | |
} | |
} | |
} | |
const output = fizzbuzz('') | |
console.log(output);</script> |
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
//Challenge 6: FIZZBUZZ | |
//Write a program that prints all of the numbers from 1 to 11 in multiples of 3, | |
//instead of the number, print "fizz", for multiples of 5 print "buzz", for numbers | |
//Which are mutiples ofboth 3 and 5, print "Fizzbuzz". | |
function fizzbuzz() | |
{ | |
//Loops through 1 - 100 | |
for(let i = 1; i <= 100; i++) | |
{ | |
if(i % 3 === 0 && i % 5 === 0) | |
{ | |
console.log('FizzBuzz') | |
} | |
//If there is a remainder of 3 | |
else if(i % 3 === 0) { | |
console.log('Fizz') | |
} else if(i % 5 === 0) | |
{ | |
console.log('FizzBuzz') | |
} | |
else | |
{ | |
console.log(i); | |
} | |
} | |
} | |
const output = fizzbuzz('') | |
console.log(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment