Fibonacci numbers in Euphoria
Example for versions
Euphoria v3.1.1,
Euphoria v4
This example uses recursive definition of Fibonacci numbers.
function fibonacci(integer n)
atom result = 1
if n <= 2 then
result = 1
else
result = fibonacci(n-1) + fibonacci(n-2)
end if
return result
end function
for i = 1 to 16 do
printf(1, "%d, ", fibonacci(i))
end for
puts(1, "...\n")
Comments
]]>blog comments powered by Disqus
]]>