RosettaCodeData/Task/Mutual-recursion/Ada/mutual-recursion-2.ada

21 lines
524 B
Ada
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

with Ada.Text_Io; use Ada.Text_Io;
procedure Mutual_Recursion is
function M(N: Natural) return Natural;
function F(N: Natural) return Natural;
function M(N: Natural) return Natural is
(if N = 0 then 0 else N F(M(N1)));
function F(N: Natural) return Natural is
(if N =0 then 1 else N M(F(N1)));
begin
for I in 0..19 loop
Put_Line(Integer'Image(F(I)));
end loop;
New_Line;
for I in 0..19 loop
Put_Line(Integer'Image(M(I)));
end loop;
end Mutual_recursion;