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 12:30
Autility company burns coal to generate electricity. the cost c(p), (in dollars) of removing p percent of the some stack pollutants is given by c(p)= 85000p/100-p a) find the cost to remove 30% of the pollutant b) find where the function is undefined
Answers: 3
question
Mathematics, 21.06.2019 15:00
In which figure is de bc ? a. figure 1 b. figure 2 c. figure 3 d. figure 4
Answers: 1
question
Mathematics, 21.06.2019 15:00
Ascatterplot is produced to compare the size of a school building to the number of students at that school who play an instrument. there are 12 data points, each representing a different school. the points are widely dispersed on the scatterplot without a pattern of grouping. which statement could be true
Answers: 1
question
Mathematics, 21.06.2019 18:30
41/17 as a decimal rounded to the nearest hundredth
Answers: 1
You know the right answer?
Write a recursive method called printNumPattern() to output the following number pattern.

Questions
question
Social Studies, 22.01.2021 16:40
question
Chemistry, 22.01.2021 16:40
question
Mathematics, 22.01.2021 16:40
question
Mathematics, 22.01.2021 16:40
Questions on the website: 13722361