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
- write a simple java program
- Need Help With A Simple Chat Program
- simple java programming tutorial
- Simple Programming sought
- Simple program
- simple frame/applet program
- Java and prolog
- Prova (from Prolog+Java)
- PROLOG
- Prolog Game
- medical diagnosis swi-prolog problem?
- find list of tuples in prolog language?
- How to find grades with the below data using prolog?
- Menu program for C Programming
- convert me this below program first into a new program using the while loop
- How to solve it?
- Can you solve part of the problem of below question
- Help required to solve one problem related to javax.swing.JTable
- need array based code to solve this polynomial
- Iteration to Solve Ax=b With Input Matrix
- Please , Help Cant Solve This Pattern ...
- please solve this question
- please solve it
- I am facing problem when exporting report using iReport 3.5.0