Fibonacci numbers in ARIBAS
Example for versions
ARIBAS 1.53
This example uses recursive definition of Fibonacci numbers.
ARIBAS uses integer type for variables by default, so type declaration can be omitted.
group(0)
is used to cancel digit groups separation by underscores during output.
function fib(n);
begin
if (n < 3) then
return(1);
end;
return(fib(n-1)+fib(n-2));
end;
function fib1_16();
var n;
begin
for n := 1 to 16 do
write(fib(n): group(0), ", ");
end;
writeln("...");
end;
fib1_16().
Comments
]]>blog comments powered by Disqus
]]>