You are on page 1of 3

INSTITUTE OF INFORMATION TECHNOLOGY

JAHANGIRNAGAR UNIVERSITY

Course Title: Artificial Intelligences and Neural Networks Lab


Course Code: IT-4102

Submitted To:
Dr. Mohammad Shahidul Islam
Associate Professor
Institute of Information Technology
Jahangirnagar University

Submitted By:
Niloy Paul
ID: 1779
4th Year 1st Semester

Date of Submission: 29.05.2022


Question-01:
Average of 3 numbers from user:
Code:
start:-
write('enter 1st number'),nl,
read(X),nl,
write('enter 2nd number'),nl,
read(Y),nl,
write('enter 3rd number'),nl,
read(Z),nl,
avg(X,Y,Z).

avg(X,Y,Z):-A is (X+Y+Z)/3,
write('Average is: '),
write(A).

Output:

Question-02:
Brother & sister rule from the family tree:
Code:
male(rahim).
male(ratul).
male(setu).
female(riya).
female(shila).
parents(rahim,ratul).
parents(rahim,riya).
parents(riya,shila).
parents(riya,setu).
father(X,Y):-parents(X,Y),male(X).
mother(X,Y):-parents(X,Y),female(X).
brother(X,Y):-parents(Z,X),parents(Z,Y),male(X),X\=Y.
sister(X,Y):-parents(Z,X),parents(Z,Y),female(X),X\=Y.

Output:

Question-03:
Importance of Prolog:
Prolog is a logic programming language associated with artificial intelligence and computational
linguistics. Prolog has its roots in first-order logic, a formal logic, and unlike many other
programming languages, Prolog is intended primarily as a declarative programming language: the
program logic is expressed in terms of relations, represented as facts and rules.
Prolog allows us to flexibly implement various specification formalisms as well as the analysis
and verification tools that go along with it. At the same time, Prolog is very fast and SICStus
Prolog is one of the fastest and most stable Prolog systems, allows access to more than 256 MB of
heap even on 32 bit systems (important for model checking), and is easy to integrate with other
programming languages (so that the GUI does not have to be developed in Prolog). These features
make it a prominent programming language that plays an important role in artificial intelligence.

Question-04:
Two Applications of Prolog:
Two applications of prolog are as follows:
 Specification Language and natural language understanding
 Robot Planning and Automation System

You might also like