In an Intro to Programming class, I doubt that recursion has been covered.

As far as the program is concerned, you have a nested loop in which the outer loop, if r1 and r2 are both positive...