Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 19th, 2012  |  syntax: None  |  size: 0.25 KB  |  hits: 1  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. object FiboScala {
  2.   def fibo(x: Int): BigInt = {
  3.     var a: BigInt = 0
  4.     var b: BigInt = 1
  5.     var c: BigInt = 0
  6.     for (_ <- 1 to x) {
  7.       c = a + b
  8.       a = b
  9.       b = c
  10.     }
  11.     a
  12.   }
  13.  
  14.   def main(args: Array[String]) = println(fibo(1000))
  15. }