Once the program is written, it must be tested. With a simple program, we can check the answers by hand. If the program does not work as expected, a useful step is to print out the values of the variables at intermediate, stages in the calculation. Once the program is running correctly these diagnostic statements can be removed. This checking a program is working correctly is known as "debugging", and the errors that a program contains are called "bugs".
When you have finished (and not until then or when you get stuck), compare your program to the hyperlinked example program with the exercise.