Answers for "write a procedure exp(Base,Exponent,Result) prolog"

0

write a procedure exp(Base,Exponent,Result) prolog

exp(_, 0, 1).
exp(0, _, 0).
exp(Base, Exponent, Result):-
    Base #>= 0,
    Exponent #>= 0,
    E1 #= Exponent-1,
    exp(Base, E1, R1),
    Result #= Base*R1.
Posted by: Guest on May-12-2021

Browse Popular Code Answers by Language