You are on page 1of 3

Course Code: CE401, Course Title: ARTIFICIAL INTELLIGENCE (3+1) – Lab

Course Instructor: Engr. ADIBA JAFFER

CE‐401 ARTIFICIAL INTELLIGENCE & ROBOTICS 
LAB # 08 
TASK # 01 

CODING:  SCREENSHOTS: 

question number
Please enter a number;
input integer ; % only accepts
integers
because I will print a table of that number for
you.
question range_s
Please enter the range (Start) for the table;
input integer ; % only accepts
integers
because Table Starting RANGE.
question range_e
Please enter the range (End) for the table;
input integer ; % only accepts
integers
because Table Ending RANGE.
action print_table ;
do ask number
and do ask range_s
and do ask range_e
and do for N from range_s to range_e
do write(' ') and write(number) and write(' x
')
and do write(N) and do write(' = ') and do
write(N * number) and nl
end for.

CONSOLE: 
| ?- print_table
.
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
Yes

Prepared By: ‘BABAR KHAN’ Enrolled as: ‘05B-030-EE’ Section: ‘A’


USMAN INSTITUTE OF TECHNOLOGY
Course Code: CE401, Course Title: ARTIFICIAL INTELLIGENCE (3+1) – Lab
Course Instructor: Engr. ADIBA JAFFER

 
TASK # 02 
 
CODING: 

question your_name do ask your_name and


Please enter your name ; do ask your_city and
input name ; do ask your_country and
because I would like to call you personally. do ask your_inst and
question your_city do ask your_cname and
Please enter your city ; do ask your_ccode and
input name ; do ask your_teacher and
because I would like to know where do you live. do ask your_dept and
question your_country do write (' base') and nl and
Please enter your country ; do write('Name: ') and write( base`s name ) and nl
input name ; and
because I would like to know where are you do write('City: ') and write( base`s city ) and nl
from. and
question your_inst do write('Country: ') and write( base`s country )
Please enter your institution ; and nl and
input name ; do write('Institution: ') and write( base`s inst ) and
because I would like to know where do you nl and
study. do write('Course Name: ') and write( base`s
question your_cname cname ) and nl and
Please enter your course title ; do for every S is an instance of base
input name ; do write (' ') and write(S) and nl and
because I would like to know what do you study. do write('Course Code: ') and write( S`s ccode )
question your_ccode and nl and
Please enter your course code ; do write('Teacher Name: ') and write( S`s teacher
input name ; ) and nl and
because I would like to know the course code. do write('Department: ') and write( S`s dept ) and
question your_teacher nl
Please enter your teacher name ; end for .
input name ;
because I would like to know what do you study.
question your_dept
Please enter your department name ;
input name ;
because I would like to know what do you study.
frame base ;
default name is your_name and
default city is your_city and
default country is your_country and
default inst is your_inst and
default cname is your_cname.
instance derived1 is a base ;
ccode is your_ccode and
teacher is your_teacher.
instance derived2 is a base ;
dept is your_dept.
action exec_prog ;

Prepared By: ‘BABAR KHAN’ Enrolled as: ‘05B-030-EE’ Section: ‘A’


USMAN INSTITUTE OF TECHNOLOGY
Course Code: CE401, Course Title: ARTIFICIAL INTELLIGENCE (3+1) – Lab
Course Instructor: Engr. ADIBA JAFFER

SCREENSHOTS: 

 
CONSOLE: 
| ?- exec_prog.
base
Name: Babar Khan
City: Karachi
Country: Pakistan
Institution: UIT
Course Name: Artificial Intelligence & Robotics
derived1
Course Code: CE-402
Teacher Name: Engr. Adiba Jaffar
Department: dept @ derived1
derived2
Course Code: ccode @ derived2
Teacher Name: teacher @ derived2
Department: Electronics Engineering
Yes

Prepared By: ‘BABAR KHAN’ Enrolled as: ‘05B-030-EE’ Section: ‘A’


USMAN INSTITUTE OF TECHNOLOGY

You might also like