Works just fine for me.
Just type main.
Don't forget the .
,otherwise it won't run.
Here is what I got
2 ?- main.
samer
true ;
lolo
true ;
koko
true.
After true
type ;
instead of pressing the Enter button if you want to show all three names. If you press Enter, only the first name will appear.
From your code I figured out that ahmad
is the father,so about the grandfather
query, I think I has to be this way:
granfather(X,Y):- father(X,U),father(U,Y).
Because on your father
query the father
is on the left