Professional Documents
Culture Documents
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
TASK # 02
CODING:
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