Selasa, 08 Desember 2009

INPUT AND OUTPUT in PROLOG.. (Exercise 6)



Exercise 6

SOAL 1
Define a predicate to output the values of the squares of the integers from N1 to
N2 inclusive and test it with N1 = 6 and N2 = 12.
JAWAB
Deklarasikan dalam bentuk notepad, kemudian simpan dengan format .pl

consult dalam prolog, lalu ketikkan outsquare(7,15). akhiri dengan tanda titik (.) lalu akan keluar hasilnya

SOAL 2
 Define and test a predicate to read in a series of characters input by the user and
output all of those before the first new line or ? character.
JAWAB
Deklarasikan dalam bentuk notepad, kemudian simpan dengan format .pl

consult dalam prolog, lalu ketikkan go. akhiri dengan tanda titik (.) kemudian tulis sesuai keinginan anda lalu akan keluar hasilnya

SOAL 3
Using the  person clauses given in Section 6.3.1, find the professions of all
those over 40.
JAWAB
Deklarasikan dalam bentuk notepad, kemudian simpan dengan format .pl

consult dalam prolog, lalu ketikkan find. akhiri dengan tanda titik (.) lalu akan keluar hasilnya



Tidak ada komentar:

Posting Komentar