1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
igor_vitrenko [27]
3 years ago
8

Number pattern Write a recursive method called print Pattern() 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.

Engineering
2 answers:
ahrayia [7]3 years ago
4 0

Answer:

import java.util.Scanner;

public class NumberPattern {  

public static void printDec(int num1 , int num2)

{

   if(num1<0)

    return ;

   System.out.print(num1+" ");

   printDec(num1-num2,num2);

}

public static void printInc(int num1, int num2)

{

int curr = num1 - ((num1/num2)*num2);

curr = curr+num2;

printstart(num1,num2,curr);

}

public static void printstart(int num1 , int num2 , int curr)

{

    if(curr>num1)

     return;

    System.out.print(curr+" ");

    printstart(num1,num2,curr+num2);

}

public static void printNumPattern(int num1 , int num2)

{

  printDec(num1,num2);

  printInc(num1,num2);

}

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

}

}

Explanation:

lilavasa [31]3 years ago
3 0

Answer:

See explaination

Explanation:

Code;

import java.util.Scanner;

public class NumberPattern {

public static int x, count;

public static void printNumPattern(int num1, int num2) {

if (num1 > 0 && x == 0) {

System.out.print(num1 + " ");

count++;

printNumPattern(num1 - num2, num2);

} else {

x = 1;

if (count >= 0) {

System.out.print(num1 + " ");

count--;

if (count < 0) {

System.exit(0);

}

printNumPattern(num1 + num2, num2);

}

}

}

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

}

}

See attachment for sample output

You might be interested in
What phenomenon allows water to reach the top of a building?
Artemon [7]

Answer:

Option C: water pressure.

Explanation:

Water pressure allows water to reach the top of a building.

6 0
3 years ago
Explain mathematically whether the divergence of the curl of a vector field is
svp [43]

Answer:

yes

Explanation:

6 0
3 years ago
How do we find percentage error in measuring voltage across a resistor​
Black_prince [1.1K]

Answer:

  use the percentage error relation

Explanation:

The percentage error in anything is computed from ...

  %error = ((measured value)/(accurate value) -1) × 100%

__

The difficulty with voltage measurements is that the "accurate value" may be hard to determine. It can be computed from the nominal values of circuit components, but there is no guarantee that the components actually have those values.

Likewise, the measuring device may have errors. It may or may not be calibrated against some standard, but even measurement standards have some range of possible error.

6 0
3 years ago
Read 2 more answers
Since the engineering design process may take the engineer back to its beginning, the process is considered ________
Valentin [98]

Answer:

Cyclical

Explanation:

I looked at the next question on edgenuity and it said it in the question.

7 0
3 years ago
Ok bye guys going offline have a great day<br>define metabolism​
Rus_ich [418]

Answer:

the chemical processes in plants or animals that change food into energy and help them grow

पेड़-पौधों और जंतुओं में होने वाली रासायनिक प्रक्रियाएँ जो भोजन को ऊर्जा में परिवर्तित कर देती हैं जिससे उनकी वृद्धि होती है; चयापचयन, उपाप्चय

Explanation:

plz mark me as brainiest

6 0
3 years ago
Read 2 more answers
Other questions:
  • Consider fully developed laminar flow in a circular pipe. If the viscosity of the fluid is reduced by half by heating while the
    5·1 answer
  • An Ideal gas is being heated in a circular duct as while flowing over an electric heater of 130 kW. The diameter of duct is 500
    9·1 answer
  • Jen is developing the positioning statement for a new line of sunglasses. In a meeting, the marketing team tells Jen that she ha
    9·1 answer
  • Which of the following is an example of seeking accreditation?
    7·1 answer
  • What are atomic bombs made out of <br> Just wondering
    10·1 answer
  • Complete the sentence to identify a useful advance in the culinary arts.
    8·1 answer
  • How to comment other people
    9·2 answers
  • Component of earthing and reasons why each material is being used<br><br>​
    5·1 answer
  • A composite plane wall consists of a 5-in.-thick layer of insulation (ks = 0.029 Btu/h*ft*°R) and a 0.75-in.-thick layer of sidi
    11·1 answer
  • D
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!