Sunday, February 16, 2025

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

 


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

%  So, what is the function for above mentioned problem.
sum(X,Y):-
 S is X+Y,
 write(S).
% Output
Prolog program to calculate the sum of two numbers
                             Prolog program to calculate the sum of two numbers

No comments:

Post a Comment

15. Write a Prolog program to implement two predicates evenlength(List) and oddlength(List) so that they are true if their argument is a list of even or odd length respectively.

  Write a Prolog program to implement two predicates evenlength(List) and oddlength(List) so that they are true if their argument is a list ...