Hi JUAN,
It seems that the program is working. I attached the results with this post. I'm using Lazarus, so the steps I followed:
1-Expanded the files to c:\problem\
2-Created a new project: Project - New Project - then selected Simple Program.
3-Copied the contents of bas-f_and_g.pas into the newly created project.
4-Complied with no errors.
5-Ran the executable, again no errors.