Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % a)
- decr(X,NX) :-
- NX is X-1.
- tabela(X, L1) :-
- helper(X, [z], L1).
- helper(0, L1, L1).
- helper(X, L, L2) :-
- decr(X, C),
- append([s], [L], L1),
- helper(C, L1, L2).
- % b)
- incr(X,NX) :-
- NX is X+1.
- vsota(0, Y, Z) :- Z is Y.
- vsota(X,Y,Z) :-
- decr(X, C1),
- incr(Y, C2),
- vsota(C1, C2, Z).
- % c)
- zmnozek(X,Y,Z) :-
- Z is X*Y.
- % d)
- stevilo(0, _).
- stevilo(N,X) :-
- C is N-1,
- append([1], X, L1),
- stevilo(C, L1).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement