subject
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
Answers: 3

Another question on Mathematics

question
Mathematics, 22.06.2019 01:00
Rewrite the polynomial -9x5 + 36x4 + 189x3 in factored form.
Answers: 1
question
Mathematics, 22.06.2019 01:00
5. write an equation for the line that is parallel to the given line and that passes through the given point. y = –5x + 3; (–6, 3)
Answers: 2
question
Mathematics, 22.06.2019 01:30
What is 60.9643790503 to 5 decimal
Answers: 1
question
Mathematics, 22.06.2019 02:30
Atriangle has side lengths of x, x+11, and 3x+5. what is the perimeter? a. 3x^2 + 38x + 55 b. 4x + 16 c. 5x + 16 d. 3x^3 + 38x^2 + 55x
Answers: 1
You know the right answer?
Write a recursive method called printNumPattern() to output the following number pattern.

Questions
question
Mathematics, 20.01.2021 21:50
question
English, 20.01.2021 21:50
question
Mathematics, 20.01.2021 21:50
Questions on the website: 13722363