[SOLVED] AI ASSIGNMENT 2-Arithmetic in Prolog

35.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

Rate this product

Write Prolog programs
1. To find the sum of all elements of a list.
2. To find the length of a list.
3. *To find the average of all elements of a list using sum and length defined in Problem 1 and 2.
4. To find the maximum number from a list.
5. *To find gcd of two integers.
6. *To generate all integers between two integers N1 and N2, both N1 and N2 included and N2>N1.
7. *To count numbers greater than 100.0 in a list.
8. *To split a list of numbers in two lists such that one contains negative numbers and other contains positive numbers.
For the Problems 9 – 13, you can only assume increment by 1 (i. e., +1), decrement by 1 (i. e., -1) and any other predicate defined earlier in 9 – 12.
9. *To recursively add two integers.
10. *To subtract two integers recursively.
11. * To multiply two integers recursively.
12. *To divide two integers recursively and get the quotient.
13. *To find the square root of an integer.
14. * To find N!.
15. *To generate first N Fibonacci numbers.
*marked problems are not done in the class.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.