Created
June 13, 2012 06:39
-
-
Save hodbby/2922328 to your computer and use it in GitHub Desktop.
Fizz Buzz
This file contains hidden or 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
<html> | |
<head><title>FizzBuzz</title></head> | |
<body> | |
<script type="text/javascript"> | |
document.write ("Counting 1 to 100, when ever number devide in 3 it is fuzz, when number devide in 5 it is buzz and both are fizzbuzz... "); | |
document.write (" "); | |
for (i=1; i<=100; i++) { | |
if (i % 3 === 0 && i % 5 === 0) { | |
document.write(" FizzBuzz ,"); | |
} | |
else if ( i % 3 === 0 ) { | |
document.write(" Fizz ,"); | |
} | |
else if (i % 5 === 0 ) { | |
document.write(" Buzz ,"); | |
} | |
else { | |
document.write(i); | |
document.write (" ,"); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you got i inside the for loop - use var i to define it (that's javascript convential)