Question: Write a recursive method called printNumPattern() to output the following number pattern. Given a positive integer as input (Ex: 12), subtract another positive integer

Write a recursive method called printNumPattern() to output the following number pattern. Given a positive integer as input (Ex: 12), subtract another positive integer (Ex: 3) continually until a negative value is reached, and then continually add the second integer until the first integer is again reached. For this lab, do not end output with a newline. Ex. If the input is: 12 WH 3 the output is: 12 9 6 3 0 -3 0 3 6 9 12 484924 3417574.qx3zay7 LAB ACTIVITY 1 import java.util.Scanner; 2 8.12.1: LAB: Number pattern 3 public class NumberPattern { 4 5 6 7 8 9 10 11 12245 13 // TODO: Write recursive printNumPattern () method public static void main(String[] args) { Scanner scnr = new Scanner(System.in); 14 } 15 } int num1; int num2; num1 = scnr.nextInt (); num2 scnr.nextInt (); printNumPattern (num1, num2); Develop mode Submit mode NumberPattern.java Enter program input (optional) If your code requires input values, provide them here. 0/10 Load default template... Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box.
Step by Step Solution
There are 3 Steps involved in it
1 NumberPatternjava import javautilScanner public class NumberPattern recursive method that takes 2 ... View full answer
Get step-by-step solutions from verified subject matter experts
