Originally Posted by pcorp1
So seeing a working program (with the required conditions in the exercise) will make me better understand how it works.
No, that would be doing your work for you and wouldn't help you one bit. The function you should have written is only a few lines long. I told you explicitly what each of those lines were. You seem to have understood most of it except the important Loop until n == 0. So you should be, if you don't know how, searching for how to loop until a condition is satisfied.

Teaching is not spoon feeding; it is helping you find your way to a solution. If this isn't the type of "assistance" you want, pay someone to do your homework for you,
-Mek