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
icang [17]
2 years ago
14

Write a C++ function using recursion that returns the Greatest Common Divisor of two integers. The greatest common divisor (gcd)

of two integers, which are not zero, is the largest positive integer that divides each of the integers. For example, the god of 8 and 12 is 4.
Computers and Technology
1 answer:
kifflom [539]2 years ago
8 0

Answer:

The function is as follows:

int gcd(int num1, int num2){

   if (num2 != 0){

      return gcd(num2, num1 % num2);}

   else {

      return num1;}

}

Explanation:

This defines the function

int gcd(int num1, int num2){

This is repeated while num2 is not 2

   if (num2 != 0){

This calls the function recursively

      return gcd(num2, num1 % num2);}

When num2 is 0

   else {

This returns the num1 as the gcd

      return num1;}

}

You might be interested in
One advantage of using a security management firm for security monitoring is that it has a high level of expertise.
mote1985 [20]

Answer: True

Explanation: Security management firm is the organization that provides protection to the system, functions,data, people etc of any particular business organization.They are highly capable of the problem avoidance, management of risk and other such issues.

The monitoring of the security done by the people and devices of the security management firm are more reliable and assured due to the expert skill they persist in the security field. Thus, the given statement is true.

8 0
2 years ago
Read 2 more answers
Write a loop that continually asks the user what pets the user has until the user enters stop, in which case the loop ends. It s
Nataliya [291]

Answer:

int counter = 0;
String userInput = "";
while (userInput != "stop") {
print "What pet do you have? ";
userInput = readInputLine();
if (userInput != "stop" ){
counter = counter + 1;
print "\nYou have one ";
print userInput;
print ". Total # of Pets: ";
print counter;
}
}

Explanation:

not sure what programming language you use, therefore the answer is pseudocode but it should give you an idea how to implement a piece of code for this problem.
Also, from the way you described the exercise I'm not sure if you always are supposed to reply with "you have one" + the pet or if you should count how often the same pet was entered.

6 0
1 year ago
How to unsubscribe from Brainly
solong [7]
Access the Settings app.
Tap your name.
Scroll down until you reach the Subscriptions feature.
Tap on Subscriptions.
Locate your Brainly Plus subscription.
Select Cancel Subscription.
Tap Confirm.
3 0
3 years ago
Read 2 more answers
Use the Web as a resource to study the PDF format. a. Describe how PDF provides output that is consistent across different types
Deffense [45]

Answer:

Explanation:

PDF or (Portable Document Format) this is a format standard to store, design, administrate, this standard include bit maps format, image format, objects, and text format, all these formats to show pages quickly, PDF is a standard and for the devices can show this format, devices like prints, laptops, or even cellphones.

6 0
3 years ago
Many large IT departments use a(n) _____ team that reviews and tests all applications and systems changes to verify specificatio
mafiozo [28]

Answer:

Quality assurance team

Explanation:

Software development life cycle (SDLC) is a process or stages of processes a software application must go through to be materialized. The stages of SDLC are planning, design, implementation or development, testing or verification, deployment and maintenance.

An implemented software design must be tested. It is tested based on the pre-dertermined design and the quality standard of the company. A group of test expect are approached for this purpose, they are called the quality assurance team

They are equipped with skills to use third party applications to analyze and verify the quality of the developed software.

6 0
2 years ago
Other questions:
  • What can a folder on a computer contain?
    13·2 answers
  • After a new technology is purchased,what are some additional costs that must be incorporated into an upgrade budget?
    6·1 answer
  • Trojan Horse is a malicious program and a virus is a program. <br><br> a. True <br> b. False
    6·1 answer
  • How to reply to text from unknown number?
    11·1 answer
  • This is not an appropriate business use for a wiki. editing corporate documents getting customer feedback project management pub
    11·1 answer
  • A major difference between digital librarians and traditional librarians is that traditional librarians rarely work with people.
    15·2 answers
  • im in honors comupter science and one of my questions is evaluate 18% 7 does anyone know how to answer that
    6·1 answer
  • A _________________________ can use SOAP headers to carry meta information in its messages. A. Web service B. REST Service C. Co
    14·1 answer
  • Second Largest, Second Smallest Write a program second.cpp that takes in a sequence of integers, and prints the second largest n
    15·1 answer
  • In order to control access to a company's intranet and other internal networks, all communications pass through a _____ server.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!