Fibonacci numbers in Euphoria
Example for versions
Euphoria v3.1.1,
Euphoria v4
This example uses iterative definition of Fibonacci numbers.
function fibonacci(integer n)
sequence result
result = repeat(1, n)
for i = 3 to n do
result[i] = result[i-1] + result[i-2]
end for
return result
end function
sequence ans = fibonacci(16)
for i = 1 to length(ans) do
printf(1, "%d, ", ans[i])
end for
puts(1, "...\n")
Comments
]]>blog comments powered by Disqus
]]>