Logo 
Search:

Artificial Intelligence Answers

Ask Question   UnAnswered
Home » Forum » Artificial Intelligence       RSS Feeds
  Question Asked By: Hasan Faruk   on Jul 23 In Artificial Intelligence Category.

  
Question Answered By: Robert Smith   on Jul 23

%for all you late visitors to this post (like myself):-)

blah(multiply,A,B,Ans) :- Ans is A*B.
blah(divide,A,B,Ans) :- Ans is A/B.
blah(add,A,B,Ans) :- Ans is A+B.
blah(subtract,A,B,Ans) :- Ans is A-B.

?- blah(add,3,4,X).
X = 7.

?- blah(Y,3,4,X).
Y = multiply,
X = 12 ;
Y = divide,
X = 0.75 ;
Y = add,
X = 7 ;
Y = subtract,
X = -1.

?-

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Simple prolog program to be solved :) Or get search suggestion and latest updates.


Tagged: