Answer:
Step-by-step explanation:
The following is written in Java and prints out the pattern to and from the first num parameter that is passed to the function. Meaning it goes from num1 to 0 and then from 0 to num1 again. It prints all of the values in a single line seperated by a space and a test case was used using the values provided in the question. The output can be seen in the attached picture below.
static void printNumPattern(int n1,int n2){
System.out.print(n1 + " ");
if(n1<=0) {
return;
} else {
printNumPattern(n1-n2,n2);
}
System.out.print(n1 + " ");
}