domains
A,B,C=integer
predicates
go
chk(A,B,C)
clauses
go:-
write("Value of
A."),nl,
readint(A),
write("Value of
B."),nl,
readint(B),
write("Value of
C."),nl,
readint(C),
chk(A,B,C).
chk(A,B,C):-
A>B and A>C,
nl,
write("A is
greater.").
chk(A,B,C):-
B>A and B>C,
nl,
write("B is
greater.").
chk(A,B,C):-
C>A and C>B,
nl,
write("C is
greater.").
chk(A,B,C):-
A=B and A>C,
nl,
write("A and B both are
greater than C.").
chk(A,B,C):-
B=C and B>A,
nl,
write("B and C both are
greater than A.").
chk(A,B,C):-
A=C and A>B,
nl,
write("A and C both are
greater than B.").
chk(A,B,C):-
A=B and B=C,
nl,
write("A,B and C are equal.").

No comments:
Post a Comment