Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment 0 Bob Petrowsky #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# fizzbuzz

CSCI-E32 Fizzbuzz assignment.
8 changes: 6 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@

<div class="container">

<h1>Hello World!</h1>
<p class="lead">This is something!</p>
<h1>FizzBuzz!</h1>
<p class="lead">Enter a positive value!</p>
<input id="input"></input>
<button id="button" onclick="var input = document.getElementById('input').value; fizzbuzz(input);">Submit</button>
<ul id="output"></ul>

</div><!-- /.container -->

Expand All @@ -36,5 +39,6 @@ <h1>Hello World!</h1>
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery-2.1.4.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/fizzbuzz.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions js/fizzbuzz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function fizzbuzz(n) {
for (i = 1; i < n; i++) {
if (i % 15 == 0) {
$('#output').append('<li>fizzbuzz</li>');
} else if (i % 5 == 0) {
$('#output').append('<li>buzz</li>');
} else if (i % 3 == 0) {
$('#output').append('<li>fizz</li>');
} else {
$('#output').append('<li>' + i + '</li>');
}
}
}