table(L) :- member(X,L), member(Y,L), Z is X*Y, write(X*Y=Z), nl, fail; nl. ?- table([1,2,3]).