Step 1 Download SWI-Prolog click here.
Step 2 Run the Installer (Follow the instruction given on the installer).
Step 3 Open the SWI-Prolog.
Step 4 Click on File (in menu) File-->New (a new window will open save it by any name with extension .pl ). A new window will open you can write your program here. After writing the program select compile (in menu in the same window) and click on “make” and again click on “compile buffer”.
Step 4 Run the query on the SWI-Prolog window.