Guest User

Untitled

a guest
Apr 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.19 KB | None | 0 0
  1. lenk(X,Y):-
  2.     X = 0,
  3.     Y is 1.
  4.  
  5. lenk(X,Y):-
  6.     X > 0,
  7.     0 is X mod 2,
  8.     Z is X - 2,
  9.     lenk(Z,N),
  10.     Y is X*N.
  11.  
  12. lenk(X,Y):-
  13.     X > 0,
  14.     1 is X mod 2,
  15.     Z is X - 1,
  16.     lenk(Z,N),
  17.     Y is X*N.
Add Comment
Please, Sign In to add comment