%----------------------
del(X,[X|L],L).
del(X,[H|L],[H|D]):-del(X,L,D).
%----------------------
%
app([],L,L).
app([H|T],L,[H|A]):-app(T,L,A).
%----------------------
dSum(0,0).
dSum(X,D):-N is X//10,dSum(N,R),Q is X mod 10,D is R+Q.
%----------------------
dNum(0,0).
dNum(X,D):-N is X//10,dNum(N,R),D is R+1.
%----------------------
base(0,_).
base(N,K):-D is N mod 10, D<K,M is N//10,base(M,K).
%----------------------
prime(X):-pr(X,2).
pr(X,Y):-N is X//2,Y>N.
pr(X,Y):-M is X mod Y, M\=0,Q is Y+1,pr(X,Q).
%----------------------
pp1_100:-pri1_100(2).
pri1_100(100).
pri1_100(X):-prime(X),write(X),nl,Q is X+1,pri1_100(Q).
pri1_100(X):-Q is X+1,pri1_100(Q).
%----------------------
tambr(X):-t(1000,0.1,0,X).
t(T,_,X,X):-T>=12000.
t(T,D,X,Y):-T_ is T+(T*D),D_ is D+0.01,X_ is X+1,t(T_,D_,X_,Y).
%----------------------
mulTable(M,N):-mulRow(M,N).
mulRow(0,_).
mulRow(M,N):-E is M-1,mulRow(E,N),mulCol(M,N),nl.
mulCol(_,0).
mulCol(X,Y):-U is Y-1, mulCol(X,U), P is X*Y,write(P),write(' ').
%----------------------
pList([]).
pList([H|T]):-write(H),pList(T).
%----------------------
add([],B,[B]).
add([H|T],X,[X,H|T]):-X<H.
add([H|T],X,[H|L]):-add(T,X,L).
%----------------------
rever(L,R):-rv(L,[],R).
rv([],R,R).
rv([H|T],L,R):-rv(T,[H|L],R).

























