Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Fibonacci-sequence/Ada/fibonacci-sequence-1.ada
Normal file
19
Task/Fibonacci-sequence/Ada/fibonacci-sequence-1.ada
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
with Ada.Text_IO, Ada.Command_Line;
|
||||
|
||||
procedure Fib is
|
||||
|
||||
X: Positive := Positive'Value(Ada.Command_Line.Argument(1));
|
||||
|
||||
function Fib(P: Positive) return Positive is
|
||||
begin
|
||||
if P <= 2 then
|
||||
return 1;
|
||||
else
|
||||
return Fib(P-1) + Fib(P-2);
|
||||
end if;
|
||||
end Fib;
|
||||
|
||||
begin
|
||||
Ada.Text_IO.Put("Fibonacci(" & Integer'Image(X) & " ) = ");
|
||||
Ada.Text_IO.Put_Line(Integer'Image(Fib(X)));
|
||||
end Fib;
|
||||
Loading…
Add table
Add a link
Reference in a new issue