Write a Prolog program to calculate the sum of two numbers.

1.Write a Prolog program to calculate the sum of two numbers.

% Write a prolog program to calculate the sum of two numbers.

%  below sum function is not predefined you can use any name as function

sum(X,Y):-
S is X+Y,
write('Sum is: '),write(S).

% Output



No comments:

Post a Comment

Featured post

Amazon Interview Process

On July 5, 1994, Jeff Bezos started the world's most "customer-centric" firm out of his garage in Bellevue, Washington. The A...