% Write a Prolog program to implement maxlist(List,Max) so that Max is the % greatest number in the list of numbers List using cut predicate. max2([H],H). max2([H|T],R):- max2(T,M1), H>=M1, R is H,!. max2([H|T],R):- max2(T,M1), H<M1, R is M1.
% Output
Prolog program to implement maxlist(List,Max) using cut predicate. |
No comments:
Post a Comment