Sunday, February 16, 2025

13. Write a Prolog program to implement palindrome(List).

 

Write a Prolog program to implement palindrome(List).

% Write a Prolog program to implement palindrome(List).

% append is the inbuilt function.

palind([]):- write('palindrome').
palind([_]):- write('palindrome').
palind(L) :-
 append([H|T], [H], L),
 palind(T)
 ;
 write('Not a palindrome').
% Output
Prolog program to implement palindrome(List).
Prolog program to implement palindrome(List).

1 comment:

  1. Struggling with coding concepts, debugging, or complex programming tasks? Quality academic guidance can help you understand programming fundamentals, improve problem-solving skills, and approach coursework with confidence. Students seeking programming assignment help can receive support with coding logic, data structures, algorithms, and project development while strengthening their technical knowledge. Choose reliable assistance that focuses on clear explanations, original work, and timely guidance, helping you learn more effectively and complete your programming assignments with greater confidence.

    ReplyDelete

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