Search: | |||||

| ||||

Home » Forum » Artificial Intelligence | RSS Feeds |

Hi,

I am new in prolog programming and I have a simple program to be solved.

A Prolog program that will take two integers and the operation (sum, subtract, multiplication, division) as input and return the operation’s result of that integers as output

if you know c language then you can do it.

best of luck.

%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.

?-

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

Related Topics:

- ideal prolog program
- Need Help With A Simple Chat Program
- simple java programming tutorial
- Simple Programming sought
- Simple program
- simple frame/applet program
- Simple picture tweaking program needed
- write a simple java program
- Prova (from Prolog+Java)
- Java and prolog
- PROLOG
- Prolog Game
- convert me this below program first into a new program using the while loop
- Menu program for C Programming
- Ubuntu 9.10 helpful program listing program
- Help required to solve one problem related to javax.swing.JTable
- How to solve it?
- Can you solve part of the problem of below question
- need array based code to solve this polynomial
- Sound Card problem solved
- please solve it
- please solve this question
- Please , Help Cant Solve This Pattern ...
- Iteration to Solve Ax=b With Input Matrix
- I need to hide the URL parameters I am using within JSPs