% Write a Prolog program to implement maxlist(List,Max) so that Max is the % greatest number in the list of numbers List. /* Max of n-#.s in a list. */ maxlist([H|T],R):- length(T,L), L>0 -> ( maxlist(T,R1), ( H > R1 -> R is H ; R is R1 ) ) ; R is H.
% Output
Prolog Program to find maximum number in the list of N numbers. |
No comments:
Post a Comment