Yep, and you even named the variables the same way. Implement the recursive version then. You just need to invert the loop condition to be your recursive base case (or alternatively, you can put the entire body of the function within the body of the if statement).
Actually, since you are only printing, you don't need to return an int, i.e., change rec's return type to void.