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, 21.06.2019 14:50
Write the linear inequality shown in the graph. the gray area represents the shaded region. y> -3y+5 y> 3x-5 y< -3x+5 y< 3x-5
Answers: 1
question
Mathematics, 21.06.2019 15:30
In δabc, if the length of side b is 3 centimeters and the measures of ∠b and ∠c are 45° and 60°, respectively, what is the length of side c to two decimal places?
Answers: 1
question
Mathematics, 21.06.2019 17:10
Determine whether the points (–3,–6) and (2,–8) are in the solution set of the system of inequalities below. x ? –3 y < 5? 3x + 2 a. the point (–3,–6) is not in the solution set, and the point (2,–8) is in the solution set. b. neither of the points is in the solution set. c. the point (–3,–6) is in the solution set, and the point (2,–8) is not in the solution set. d. both points are in the solution set.
Answers: 3
question
Mathematics, 21.06.2019 17:30
Enter the missing numbers in the boxes to complete the table of equivalent ratios.time (min) distance (km)? 36 9? 1512 ?
Answers: 3
You know the right answer?
Write a recursive method called printNumPattern() to output the following number pattern.

Questions
question
Mathematics, 23.04.2021 16:40
question
Mathematics, 23.04.2021 16:40
question
Biology, 23.04.2021 16:40
question
Mathematics, 23.04.2021 16:40
Questions on the website: 13722367