Program find_max(X, Y, X) :- X >= Y, !.find_max(X, Y, Y) :- X Y. Similarly find_min(X,Y,Min) takes X and Y values, and store the minimum value into the Min variable. This takes X and Y values, and stores the maximum value into the Max. First, we will create two predicates, find_max(X,Y,Max). Here we will see one Prolog program, that can find the minimum of two numbers and the maximum of two numbers. Verify whether a line segment is horizontal, vertical or oblique In the following chapter, we are going to discuss basic prolog examples to −įind the equivalent resistance of a resistive circuit
0 Comments
Leave a Reply. |