0% found this document useful (0 votes)
102 views2 pages

Prolog Assgn

The document lists 30 Prolog programming assignments involving data structures like lists and trees, mathematical operations like Fibonacci series, factorials, and GCDs, and other logic problems like palindromes, permutations, sorting, and regular expressions. The assignments cover foundations of Prolog like predicates, recursion, and unification as well as more advanced topics such as digital logic, binary trees, and set operations.

Uploaded by

Mazharulislam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views2 pages

Prolog Assgn

The document lists 30 Prolog programming assignments involving data structures like lists and trees, mathematical operations like Fibonacci series, factorials, and GCDs, and other logic problems like palindromes, permutations, sorting, and regular expressions. The assignments cover foundations of Prolog like predicates, recursion, and unification as well as more advanced topics such as digital logic, binary trees, and set operations.

Uploaded by

Mazharulislam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PROLOG Assignments

1. Write a prolog program to represent a family tree and write the predicates for different
relationships like father, mother, brother, sister, cousin, grandmother, grandfather etc.

2. Write a prolog program to find the circumference and area of a circle.

3. Write a prolog program to find the ‘N’th Fibonacci term.

4. Write a prolog program to find the Fibonacci series upto N terms.

5. Write a prolog program to compute the factorial of a given number.

6. Write a prolog program to find whether a given number is odd or even.

7. Write a prolog program to determine whether a given number is prime or not.

8. Write a prolog program to find the sum and average of a list of numbers.

9. Write a prolog program to find the minimum and maximum from a list of numbers.

10. Write a prolog program to find the GCD of a list of numbers.

11. Write a prolog program to find whether a number is a member of a list or not.

12. Write a prolog program to find the size of a list.

13. Write a prolog program to find the last element of a list.

14. Write a prolog program to delete the ‘K’th element from a list.

15. Write a prolog program to concatenate two lists.

16. Write a prolog program to insert an element at the Kth position.

17. Write a prolog program to determine whether an input string is accepted by the DFA
constructed from the regular expression: c(a|b)*d+

18. Write a prolog program to determine whether an input string is accepted by the DFA
constructed from the regular expression: (a|b)+(cd)*e

19. Write a prolog program to implement two-input XOR gate using two-input NAND gates only.

20. Write a prolog program to represent a digital circuit to find an output.


21. Write a prolog program to sort a given list using merge sort.

22. Write a prolog program to sort a given list using insertion sort.

23. Write a prolog program to reverse a list. Also determine whether a given list is palindrome or
not.

24. Write a prolog program to find the union, intersection and set difference of two lists of elements.

25. Write a prolog program to generate all permutations of a list of elements.

26. Write a prolog program to eliminate the duplicate elements of a list. The output list should
contain the unique elements.

27. Write a prolog program to generate all integers in a given range.

28. Write a prolog program to generate a binary tree and write predicates for the following: path,
leaf, root, sibling, height, level.

29. Write a prolog program to generate the nodes traversed in preorder, postorder and inorder
traversals.

30. Write a prolog program to count the number of vowels in a list of characters (word).

You might also like