Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mul(0,_,0):-!.
- mul(X,_,_):- X < 0,!.
- mul(1,X,X).
- mul(X,Y,R) :- X1 is X-1, mul(X1,Y,R1),!, R is R1 + Y.
- % silnia(0,1):-!.
- % silnia(X,W) :- X1 is X-1, silnia(X1,W1), W is X * W1.
- % silnia (X,X):-!.
- % silnia(X,W):- silnia(1,X,W).
- silnia(X,Y,Z):- X>Y, !.
- silnia(X,Y,W) :-
- X1 is X+1,
- W1 is W * X,
- silnia(X1,Y,W1).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement