Skip to content

Instantly share code, notes, and snippets.

@dgadiraju
Last active May 7, 2017 02:01
Show Gist options
  • Save dgadiraju/c8af7df10e3b8df7bebb65c64abbec99 to your computer and use it in GitHub Desktop.
Save dgadiraju/c8af7df10e3b8df7bebb65c64abbec99 to your computer and use it in GitHub Desktop.
def fibo(i: Int) = {
var pre = 0
var curr = 1
var res = 0
print(pre + "\t" + curr)
for(e <- 2 to i - 1) {
res = pre + curr
pre = curr
curr = res
print("\t" + res)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment