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
What protein is found in hair and nails
Yuliya22 [10]

Keratin is found in both hair and nails.

Hope this helps!

4 0
3 years ago
Read 2 more answers
How can a PowerPoint user add a shadow to a table
damaskus [11]
Https://wordribbon.tips.net/T010192_Drop_Shadows_for_Tables.html
8 0
3 years ago
A _______ bulb contains a high-pressure gas. Oils from the hands can affect the expansion of the glass, which can shorten the li
shusha [124]

Answer:

I'd go with the 2nd one

If it heats up more & more, then it's lifespan will be shortened more & more.  The more it heats up, the less durability it has.

6 0
3 years ago
Krista needs to configure the default paste options in PowerPoint 2016. Which area of the Options dialog box will she need to us
Norma-Jean [14]

Answer:

\red{\underline{\underline{\sf{Answer :-}}}}

★ Advanced

3 0
3 years ago
Read 2 more answers
While your hands are on home row, your right hand rests lightly on _____.
ollegr [7]

Answer:

jkl;

Explanation:

6 0
3 years ago
Other questions:
  • Calculated fields can be entered in queries. What row should you type a calculated field in?
    13·1 answer
  • Match the software requirements of a server to their purpose
    5·1 answer
  • What is are motor vehicle emissions?
    8·1 answer
  • Why is it generally a good idea to set the font size to at least 30 points in presentations?
    6·2 answers
  • New trends, tools, and languages emerge in the field of web technology every day. Discuss the advantages of these trends, tools,
    15·1 answer
  • How do I modify objects in power point 2016 for an assignment
    11·1 answer
  • What does the revolver do computer science​
    9·1 answer
  • Which of the following is not a data visualization technique?
    6·1 answer
  • I WILL MARK BRAINIEST FOR THIS!!!!!!
    11·2 answers
  • This is your code.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!