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 16:30
Question 5 spring semester final exam math evaluate
Answers: 1
question
Mathematics, 21.06.2019 17:30
Simplify the expression 10/11(22z) + (a+5) -1
Answers: 2
question
Mathematics, 21.06.2019 19:20
Which letters from the table represent like terms? a and b b and c a and d b and d
Answers: 3
question
Mathematics, 21.06.2019 21:30
High school seniors with strong academic records apply to the nation’s most selective colleges in greater numbers each year. because the number of slots remains relatively stable, some colleges reject more early applicants. suppose that for a recent admissions class, an ivy league college received 2851 applications for early admission. of this group, it admitted 1033 students early, rejected 854 outright, and deferred 964 to the regular admission pool for further consideration. in the past, this school has admitted 18% of the deferred early admission applicants during the regular admission process. counting the students admitted early and the students admitted during the regular admission process, the total class size was 2375. let e, r, and d represent the events that a student who applies for early admission is admitted early, rejected outright, or deferred to the regular admissions pool.suppose a student applies for early admission. what is the probability that the student will be admitted for early admission or be deferred and later admitted during the regular admission process?
Answers: 3
You know the right answer?
Write a recursive method called printNumPattern() to output the following number pattern.

Questions
question
Mathematics, 03.09.2019 20:30
Questions on the website: 13722360