So, which part are you missing?
The absolute value, you can get with abs().
You assign variables just like you wrote in your pseudocode.
To repeat commands, you can use several alternatives; the most appropriate in this case seems DO WHILE.
Quick input can be done with ACCEPT or INPUT, but in general, input is best done with TextBoxes and other objects on a form.
Part of your desired code might look like this:
...
i = 1
p = g(p0)
do while i <= n and abs(p-p0) < SmallNumber
i = i + 1
p = g(p)
enddo
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)