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
kap26 [50]
3 years ago
13

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) continuallyuntil 0 or a negative value is reached, and then continually add the second integer until therst integer is again reached. For this lab, do not end output with a newline.
Computers and Technology
1 answer:
aleksley [76]3 years ago
6 0

Answer:

Explanation:

The following is written in Java and prints out the pattern to and from the first num parameter that is passed to the function. Meaning it goes from num1 to 0 and then from 0 to num1 again. It prints all of the values in a single line seperated by a space and a test case was used using the values provided in the question. The output can be seen in the attached picture below.

static void printNumPattern(int n1,int n2){

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

       if(n1<=0) {

           return;

       } else {

           printNumPattern(n1-n2,n2);

       }

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

   }

You might be interested in
The _____ stage of information technology planning outlines business processes that are central to achieving strategic goals and
bija089 [108]

Answer:

d. business area analysis

Explanation:

Business area analysis is the stage of information technology planning outlines business processes that are central to achieving strategic goals and helps determine which ones could most benefit from information technology.

Here the major focus is on planning the outlines required to achieve the central objective of business.

It outlines all the business process, the goals and helps to determine the most benefit from information technology.

3 0
3 years ago
Who was the inventor of the iPhone?
Over [174]

Steve Jobs and his team at Apple invented the iPhone.

6 0
3 years ago
Read 2 more answers
What type of major application has most changed the way people interact in their daily lives?
kogti [31]
Social media, Facebook has become really popularized as has youtube and tumblr. Many people communicate through messenger on facebook, videos on youtube and just posting different things on tumblr. The way people put themselves out into the world, and portray who they are to people across the world is huge change from say 20 years ago.
5 0
3 years ago
please help me!!!!!! all of the following may be benefits of a technical or vocational college except
-BARSIC- [3]

Answer:

im not sure

Explanation: is their supposed to be a picture or something?

5 0
4 years ago
Read 2 more answers
If you are signed into a Microsoft account and need to sign into another one, click ____ on the list arrow next to Your Name in
torisob [31]

Answer:

left

Explanation:

If you are signed into a Microsoft account and need to sign into another one, click left on the list arrow next to Your Name in the top-right corner of the Word window.

Multiple Microsoft accounts can be opened at one time in different tabs of your computer. They can be used simultaneously as well. It helps the user to work efficiently rather than logging in or logging out from his accounts which hinders effective and efficient output.

5 0
3 years ago
Other questions:
  • Which method of encryption is based on physics principles?
    5·1 answer
  • Technician A says that as volume decreases, pressure increases. Technician B says that as temperature increases, pressure decrea
    5·1 answer
  • Scavenging is a form of fraud in which the perpetrator uses a computer program to search for key terms in a database and then st
    14·1 answer
  • Sharon is a network engineer for your firm and is investigating the WAN connection into the hot site. In the event of operations
    13·1 answer
  • Find the area of the regular hexagon below by using the area formula for triangles.
    7·1 answer
  • Given the code below, which three statements can be used to create the controller variable?
    5·1 answer
  • A software team is setting an automation strategy and begins by identifying business processes that could benefit from automatio
    12·1 answer
  • A 90-minute film is based on a fictional couple. They are very happy throughout the entire film. The film shows how they met, wh
    5·2 answers
  • HELP ASAP IF YOU KNOW PYTHON 2!!!
    15·1 answer
  • HELP ME PLEASE 41 PTS
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!