I am trying to find max,mid and min number from 3 given number. The code is:
t_max(X,Y,Z):-
A is max(max(X,Y),max(Y,Z)),
C is min(min(X,Y),min(Y,Z)),
(X>=A,X=<C)->B is X;
(Y>=A,Y=<C)->B is Y;
(Z>=A,Z=<C)->B is Z;
format('~w ~w ~w',[A,B,C]).
When i try to run the method with any three numbers, I get this error "ERROR: >=/2: Arguments are not sufficiently instantiated". Why I'm getting this error?
Aucun commentaire:
Enregistrer un commentaire