Last active
May 7, 2017 02:01
-
-
Save dgadiraju/c8af7df10e3b8df7bebb65c64abbec99 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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