Prolog problem for addition of two numbers in Artificial Intelligence


% Md. Alamgir Hossain

% CSE, JUST

%  Prolog program for addition of two numbers------------

go:- write('Enter first number : '),read(X),nl,

    write('Enter second number : '),read(Y),nl,

    sum(X,Y).

sum(X,Y):-

 S is X+Y,

 write('Summation of the two given number is : '),

 write(S).
 % End of code
Go to console and check the input and output------------ 
 Input :
 go.

Enter first number : 200.
Enter second number : 100. 
Output : 
Summation of the two given number is : 300






No comments:

Post a Comment