Answer:
The function in C++ is as follows:
int itr, kount;
void printNumPattern(int num1,int num2){
 if (num1 > 0 && itr == 0) {
 cout<<num1<<" ";
 kount++;
 printNumPattern(num1 - num2, num2);
 } else {
 itr = 1;
 if (kount >= 0) {
 cout<<num1<<" ";
 kount--;
 if (kount < 0) {
 exit(0);}
 printNumPattern(num1 + num2, num2);}}
}
Step-by-step explanation:
We start by declaring global variables itr and kount
int itr, kount;
The function is defined here
void printNumPattern(int num1,int num2){
If num1 and itr are greater than 0 , then
 if (num1 > 0 && itr == 0) {
Output num1, followed by a space
 cout<<num1<<" ";
Increment counter by 1
 kount++;
Call the recursion
 printNumPattern(num1 - num2, num2);
If otherwise
 } else {
Set itr to 1
 itr = 1;
If counter is 0 or positive
 if (kount >= 0) {
Output num1, followed by a space
 cout<<num1<<" ";
Decrease counter by 1
 kount--;
If counter is negative
 if (kount < 0) {
Exit function
 exit(0);}
Call the recursion 
 printNumPattern(num1 + num2, num2);}}
}