eval.in

Paste #201

JavaScript — Node 0.8.8, pasted 4 years ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
function fib(n) {
  var a = 0, b = 1;
  for(var i = 0; i < n; i++) {
    var c = a + b;
    b = a;
    a = c;
  }
  return a;
}

console.log(fib(30));

Program Output

832040

OK (0.040 sec real, 0.040 sec wall, 42 MB, 28 syscalls)

Fork