Question: Design Prolog Programs for the following. Q 1 . To test whether given numbers are pythagorean triple. Eg: Input: ? - is _ triple (

Design Prolog Programs for the following.
Q1. To test whether given numbers are pythagorean triple.
Eg: Input: ?-is_triple(3,4,5).
Output: true
Q2. Find if given numbers are coprime.
Eg: Input: ?-coprime(35,64).
Output: true
Q3. Check whether given numbers form a geometric sequence.
Eg: Input: ?-is_geometric_sequence(3,6,12).
Output: true
Q4. Write a Prolog program that asks the user for their birth year and calculates and prints their age:
Eg: Input: ?-age
Enter your birth year: 2005
Output: You are 19 years old.
Q5. Check a Prolog program that prompts the user to enter their Employee ID and displays their de-
partment based on a predefined database. If the entered Employee ID is incorrect (i.e., not found in
the database), the program should prompt the user to enter the Employee ID again until a valid one
is entered.
Use the following predefined employee database:
Employee ID 123 belongs to the "manager" department.
Employee ID 324 belongs to the "hr" department.
Eg: Input: ?-get_dept
Enter your Employee ID: 123
Output: Your Employee ID is 123 and you belong to the department:
manager
Input: ?-get_dept
Enter your Employee ID: 122
Output: Incorrect Employee id, enter again.
Enter your Employee ID: 123
Your Employee ID is 123 and you belong to the department:
manager
please dont use chatgpt or any other plagarism websites explain clearly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!