answer.
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]
2 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]2 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
In public-key encryption, the two keys–one for coding and one for decoding–are known as ________.
Feliz [49]
Public key and private key  - In public key encryption, a pair of keys is used (public key and private key). The public key can be made available publicly, while the private key is only known  by the owner. The public key is used to encrypt the message, while the private key is used to decrypt the message.
5 0
1 year ago
Your network administrator finds a virus has been successfully inserted into the network software. The virus itself is now consi
Svetlanka [38]

Answer: Vulnerability of

Explanation:

The network administrator was able to identify that virus before it led to denial of service to users. Since it has been discovered, it is no longer a threat as measures will be taken to eliminate it. But a virus that was successful uploaded shows how vulnerable the system is or how bad the security protections put in place are. Steps has to be taken to ensure it does not reoccur.

7 0
1 year ago
Read 2 more answers
How has the perception of the hacker changed over recent years? What is the profile of a hacker today?
finlep [7]

Answer:

Hackers frequently spend long hours examining the types and structures of targeted systems because they must use guile, or fraud to bypass the controls placed on information owned by someone else.

Explanation

The perception of a hacker has evolved over the years.

  • The traditional hacker profile was a male, aged 14 to 18.
  • 76% of hackers are men whose ages are between 14 years (8%) to 50 (11%). The average age is 35 years (43%).
  • A hacker is persevering, patient, creative, bright and having a passion for what he does.
  • Hackers today can be expert or novices.
  • The experts create the software and schemes to attack computer systems.
  • While the novices merely use software created by the experts.
4 0
2 years ago
BlockPy: #35.2) Animal Splits Write a function all_cats that consumes a comma-separated string of animals and prints whether all
maks197457 [2]

Answer:

def all_cats(data):

 dataArray = data.split(',')

 if(data==""):

   return True

 for i in dataArray:

   if('cat' not in i):

     return False

 

 return True

print(all_cats("gerbil,catfish,dog,cat"))

print(all_cats("cat,catfish"))

print(all_cats(""))

Explanation:

Step 1: define de function and the parameters

def all_cats(data):

Step 2: split the data by ,

dataArray = data.split(',')

Step 3 : validate if is an empty data and return true

if(data==""):

   return True

Step 4: Loop over de array data and validate if have cat in each data if not, then return false

for i in dataArray:

   if('cat' not in i):

     return False

Step 5 if have cat in each one return true

return True

Step 6 Validate with examples

print(all_cats("gerbil,catfish,dog,cat"))

print(all_cats("cat,catfish"))

print(all_cats(""))

6 0
1 year ago
A time-saving strategy that helps define unfamiliar words involves using
yuradex [85]

The correct answer is A. Familiar words for clues

Explanation:

Finding unfamiliar words is common while reading, especially in texts that belong to a specific field such as medicine, technology, etc. This can be handled through multiple strategies such as using a dictionary, guessing the meaning of the word based on its parts, and using context clues.

In this context, one of the easiest and most time-saving strategy is the use of context clues that implies using the familiar words as clues to guess the meaning of an unfamiliar word. This is effective because in most cases the meaning of an unknown word can be determined using the context of the word or words around the unknown word. Also, this strategy takes little time because you only need to analyze the sentence or paragraph where the unknown word is. Thus, the time-saving strategy to define unfamiliar words involves using familiar words for clues.

6 0
1 year ago
Read 2 more answers
Other questions:
  • What are the pros and cons of using unique closing reserved words on compound statements?
    15·1 answer
  • Which references are updated when you copy the formula =$E6-MAX(H$1:J4)
    10·1 answer
  • A ____ resembles a circle of computers that communicate with each other.
    14·1 answer
  • Assume that month is an int variable whose value is 1 or 2 or 3 or 5 ... or 11 or 12. Write an expression whose value is "jan" o
    10·1 answer
  • Which one of the following is a correct declaration for a method named passAList that has as arguments an array list myList of s
    8·1 answer
  • A news channel runs a two-minute story on phishing scams. The report features the testimonies of a phishing victim and a compute
    7·1 answer
  • A school principal trying to find out if parents will help buy new playground equipment shows digital leadership by.
    8·2 answers
  • What is the average number of nodes accessed in search for a particular element in an unordered list? In an ordered list? In an
    6·1 answer
  • Write a program that takes a single integer input from the user and stores it in a variable. Your program should increase the va
    15·1 answer
  • Which of the following is an advantage of inserting a page number field in your document rather than inserting each page number
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!