Permalink
Browse files

Yay for FizzBuzz!

  • Loading branch information...
0 parents commit d51959eda01b2918cda0405a2cbd523b6c50cb18 @coolaj86 committed Jun 26, 2010
Showing with 58 additions and 0 deletions.
  1. +9 −0 README
  2. +16 −0 fibonacci.js
  3. +21 −0 fizzbuzz.js
  4. +6 −0 fizzbuzz.rb
  5. +6 −0 hello.js
9 README
@@ -0,0 +1,9 @@
+FizzBuzz
+========
+
+An array of the usual suspects - Hello World, FizzBuzz, Fibonacci, more to come...
+
+TODO
+----
+ * Echo Client / Server
+ * Ajax Chat
@@ -0,0 +1,16 @@
+#!/usr/bin/env node
+"use strict";
+var sys = require('sys');
+(function () {
+ var seq = [];
+ function fibonacci(a, b) {
+ seq.push(a);
+ if (a >= 100) {
+ seq.push(b);
+ return;
+ }
+ fibonacci(b, a+b);
+ }
+ fibonacci(0,1);
+ sys.print(seq.join(', ') + "\n");
+}());
@@ -0,0 +1,21 @@
+#!/usr/bin/env node
+"use strict";
+var sys = require('sys');
+(function () {
+ var i, n;
+ for (i = 1; i <= 100; i += 1) {
+ n = false;
+
+ if (0 === (i % 3)) {
+ n = true;
+ sys.print("Fizz");
+ }
+ if (0 === (i % 5)) {
+ n = true;
+ sys.print("Buzz");
+ }
+ if (true === n) {
+ sys.print("\n");
+ }
+ }
+}());
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+(1..100).each do |x|
+ print "Fizz" if 0 == (x % 3)
+ print "Buzz" if 0 == (x % 5)
+ print "\n" if 0 == (x % 3) || 0 == (x % 5)
+end
@@ -0,0 +1,6 @@
+#!/usr/bin/env node
+"use strict";
+var sys = require('sys');
+(function () {
+ sys.print("Hello World!\n");
+}());

0 comments on commit d51959e

Please sign in to comment.