Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %1
- pot(_,0,1):-!.
- pot(Base,Exp,Poten):-Y is Exp-1,pot(Base,Y,Pt),Poten is Base*Pt.
- %3
- sum([L|[]],L):-!.
- sum([L|C],X):-sum(C,Y),X is L+Y.
- count([],0):-!.
- count([_|C],X):-count(C,Y),X is Y+1.
- media(X,L):-sum(L,S),count(L,C), X is S/C.
- %2
- pred([],L,L):-!.
- pred([X|L1],L2,[X|L3]):-pred(L1,L2,L3).
- mist([X],[X]):-!.
- mist([X|C],L):-mist(C,L1),pred(L1,[X],L).
- igual([],[]):-!.
- igual([X|Cx],[X|Cl]):-igual(Cx,Cl).
- palindrome(X):-mist(X,L),igual(X,L).
- %5
- colocar(X,[],[X]):-!.
- colocar(X,[L|C],[L|L3]):-X>L,colocar(X,C,L3),!.
- colocar(X,[L|C],[X|[L|C]]).
- ord([X|[]],[X]):-!.
- ord([X|C],L):-ord(C,L2),colocar(X,L2,L).
Add Comment
Please, Sign In to add comment