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
vredina [299]
4 years ago
5

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:
Computers and Technology
1 answer:
TiliK225 [7]4 years ago
7 0

Answer:

See Explanation Below

Explanation:

// C++ printNumPattern() recursive method

// Comments are used for explanatory purpose

// Only the recursive is submitted

// Method starts here

void printPattern(int num1, int num2, bool dec)  

{  

// Print num2.  

cout << num2 << " ";  

//Printing to num1

if (dec == false && num1 ==num2)  {

 return;  }

// Printing to 0 or negative.  

if (dec)  

{  

// If num2 is greater than num2

if (num2-num1 > 0)  

 printPattern(num1, num2-num1, true);  

else // recur with false dec  

 printPattern(num1, num2-num1, false);  

}  

else // If dec is false.  

 printPattern(num1, num2+num1, false);  

}  

//End of recursive

You might be interested in
The 10 IISSCC _____ cover 17 NIST control _____ which are arranged in three _____ called management, operational, and technical.
almond37 [142]

Answer:

Controls, families, domain

Explanation:

ISSCC means international information systems security certification consortium.

They are also known as ISC square, they offer two security certification the cissp and sccp.

7 0
3 years ago
Read 2 more answers
Someone please help ASAP will brainlist
Arada [10]

Answer:

i cant help

Explanation:

4 0
3 years ago
Read 2 more answers
Explain how communication promotes cooperation and industrial peace​
tensa zangetsu [6.8K]

Explanation:

Communication helps the management to know what the organisation wants and how it can be performed. Through effective way of communication it promotes the industrial peace and good relations. 7. ... It enables the management to take managerial decisions which depends upon the quality of communication.

4 0
3 years ago
When you listen to a guitar duet and have trouble hearing the melody, which of the following would best explain the problem?
emmasim [6.3K]

Answer:

One of the guitarists is playing too loud.

Explanation:

My dad plays the guitar...?

I'm shocked it's not "not keeping a steady beat", so I'm certain this is it.

3 0
3 years ago
Read 2 more answers
How is a life cycle analysis used to <br> make decisions about technology?​
kumpel [21]
It is used to assess the environmental impacts of a product, process, or activity. i extracts materials through to processing transport use and disposal
4 0
4 years ago
Other questions:
  • Html version ____ added support for style sheets to give web designers greater control over page layout and appearance.
    10·1 answer
  • In real-world environments, risks and their direct consequences will most likely span across several domains. However, in the la
    12·1 answer
  • Crack the secret message: Crrp, Crrp, Crrp Zh’uh jrlqj wr wkh prrq. Li brx zdqw wr wdnh d wuls, Folpe derdug pb urfnhw vkls. (hi
    7·1 answer
  • To which built-in object does the function sin(x) belong?
    12·1 answer
  • Consider a Rational class designed to represent rational numbers as a pair of ints, along with methods reduce (to reduce the rat
    10·1 answer
  • Page Up and Page Down keys fall under the ? keys category.
    14·2 answers
  • Regular languages are closed under complement. True False
    7·1 answer
  • What is ‘Software Quality Assurance’?
    10·1 answer
  • A___ is a placeholder where you can enter text to manipulate and give new graphical effects.​
    13·1 answer
  • Why do we buy new asset​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!