Here are the details of my code
name:-read(X),write(\'Name : \'),write(X),nameCode(X). nameCode(X):-nl, write(\'Name Code : \').