Recursive Pattern
Description Given a positive integer 'n' and another positive integer 'k' (<n), print the following pattern using recursion.
Example:
Input 1: n = 12, k = 5
Output 2: 12, 7, 2, -3, 2, 7, 12
Input 2: n = 10, k =2
Output 2: 10, 8, 6, 4, 2, 0, 2, 4, 6, 8, 10
Basically, you need to keep decrementing the given value of 'n' by 'k' until you encounter 0 or a negative number, in which case, you need to start incrementing by 'k' until you reach 'n' again.
Format:
Input: The first line contains the positive integer 'n'. The second line contains the positive integer 'k'.
Output: The required pattern as comma-separated-values as shown in the examples above.