![subject](/tpl/images/cats/mat.png)
Mathematics, 14.02.2020 16:30 camiilajakobsen1400
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 0 or a negative value is reached, and then continually add the second integer until the first integer is again reached.
Ex. If the input is
12
3
the output is
12 9 6 3 0 3 6 9 12
Code Below:
import java. util. Scanner;
public class NumberPattern {
// TODO: Write recursive printNumPattern() method
public static void main(String[] args) {
Scanner scnr = new Scanner(System. in);
int num1;
int num2;
num1 = scnr. nextInt();
num2 = scnr. nextInt();
printNumPattern(num1, num2);
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Other questions on the subject: Mathematics
![image](/tpl/images/cats/mat.png)
![image](/tpl/images/cats/mat.png)
![image](/tpl/images/cats/mat.png)
![image](/tpl/images/cats/mat.png)
Mathematics, 22.06.2019 03:10, erinleyanne
If f(x) = 5х – 2 and g(x) = 2х + 1, find (f – g)(x).
Answers: 1
You know the right answer?
Write a recursive method called printNumPattern() to output the following number pattern.
Questions in other subjects:
![Konu](/tpl/images/cats/mat.png)
Mathematics, 12.11.2020 17:50
![Konu](/tpl/images/cats/ap.png)
Advanced Placement (AP), 12.11.2020 17:50
![Konu](/tpl/images/cats/en.png)
![Konu](/tpl/images/cats/en.png)
![Konu](/tpl/images/cats/en.png)
English, 12.11.2020 17:50
![Konu](/tpl/images/cats/mat.png)
Mathematics, 12.11.2020 17:50
![Konu](/tpl/images/cats/mat.png)
Mathematics, 12.11.2020 17:50
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/ekonomika.png)
Business, 12.11.2020 17:50