Mathematics
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);

answer
Answers: 3

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 18:30, viktoria1198zz
Florence price's brownies and more sells all types of cookies and pastries. on tuesdays, they markdown all brownies 75% to a sale of $1.50 a dozen. find the selling price and the markdown of a dozen brownies.
Answers: 1
image
Mathematics, 22.06.2019 00:00, shay68596
One positive integer is 2 less than another. the product of the two integers is 24. what are the integers?
Answers: 1
image
Mathematics, 22.06.2019 02:00, love12236
Th perimeter of a rectangular garden is 150 feet. the length is 50 feet longer than the width, w. which equation could be used to calculate the width of the garden? a.) 2w+ 2(w-50) =150 b.) 2w+50 + 2w =150 c.) 2(w+50) + w =150 d.) 2w+ 2(w + 50) = 150 need asap. will give brainliest !
Answers: 1
image
Mathematics, 22.06.2019 02:00, bchagnard2122
Grant simplified the expression 1.5(-3.2 + 2.5) his work is shown below explain the error in grants work
Answers: 1
Do you know the correct answer?
Write a recursive method called printNumPattern() to output the following number pattern.

Questions in other subjects:

Konu
Mathematics, 31.03.2021 18:20
Konu
Mathematics, 31.03.2021 18:20
Konu
Arts, 31.03.2021 18:20