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]
3 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]3 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
Using complete sentences post a detailed response to the following.
german

Answer:

Some guidelines on how to share information in a public space are to credit the owner of the picture, article, etc that are being used. If you want to use someone else's photo or song in one of your own projects, you'll need to make sure you have the legal right to do so before hand. According to copyright law, any original content you create and record in a lasting form is your own intellectual property. This means other people can't legally copy your work and pretend it's their own. They can't make money from the things you create either.

Explanation:

I hope this helps. please don't copy.

4 0
3 years ago
Read 2 more answers
The value of the expression 20.0 * (9/5) + 32.0 is
Rama09 [41]

Answer:

68

Explanation:

9/5 = 1.8

20 * 1.8 + 32

20 * 1.8 = 36

36 + 32 = 68

7 0
3 years ago
As a student you are able to earn extra money by assisting your neighbors
Lorico [155]
You can just earn extra money by doing your neibors lawn
8 0
3 years ago
Read 2 more answers
Construct a formula in cell D11 to calculate the sales tax amount for transaction 578. Be sure to appropriately reference the tr
Vlada [557]

Answer:

Explanation:

Formulas!D11: =C11*0.0675

4 / 7  (57.1%)

Feedback:

[-2] The formula in cell D11 does not reference the sales tax rate

[-1] The tax rate reference is not absolute

Copy the formula you used in cell D11 down to calculate the sales tax amount for the remaining transactions.

1 / 1  (100.0%)

Feedback:

Construct a formula in cell E11 to calculate the total amount for transaction 578. Be sure to appropriately reference the transaction amount in cell C11 and the sales tax amount in cell D11 so that you can reuse your formula to calculate the total for the remaining transactions.

Formulas!E11: =SUM(C11:D11)

6 / 6  (100.0%)

Feedback:

Copy the formula you used in cell E11 down to calculate the total for the remaining transactions.

2 / 2  (100.0%)

Feedback:

Use the SUM function to calculate the “Grand Total” in for all transactions in cell E24.

Formulas!E24: =SUM(E11:E23)

4 / 4  (100.0%)

7 0
3 years ago
1. What is the connection between a credit report and a credit score?
viktelen [127]

Answer:

<em>Credit report: A credit report is a record of a consumer's credit history and serves as credit references. Credit score: A credit score is an algorithm that measures your credit risk based on the information in your credit report at one point in time.</em>

Hope this helps!!

5 0
3 years ago
Other questions:
  • If you are trying to create a web page for your band and having difficulty creating links to other groups on your page, what is
    7·1 answer
  • The scope of a variable declared inside of a function is:
    8·1 answer
  • Why is printer an output device​
    14·2 answers
  • Name the written test a potential driver must pass and list the minimum required score to earn a learner’s license.
    8·2 answers
  • Please answer that and i'll gave you branlliest
    15·1 answer
  • You defined the raft class as shown.
    10·1 answer
  • Describe the uses of computer in different fileds? please help me ​
    14·1 answer
  • How to use function in python
    10·1 answer
  • MODS ONLY answer this, I have something for you. I'm reporting this to make it easier
    14·1 answer
  • What is the first step in finding a solution to a problem? Choose a solution. Think of options to solve the problem. Try the sol
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!