Advertisement
dzieciol

mul

May 21st, 2018
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.10 KB | None | 0 0
  1. mul(0,_,0):-!.
  2. mul(X,_,_):- X < 0,!.
  3. mul(1,X,X).
  4. mul(X,Y,R) :- X1 is X-1, mul(X1,Y,R1),!, R is R1 + Y.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement