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
OH NO THE HEAVY IS DEAD
Anarel [89]

Answer:

what does that mean?

are you okay?

Did something happen?

4 0
3 years ago
Read 2 more answers
What is the purpose of an index page feature in a Word document? Check all that apply.
Delvig [45]

Answer:

A. Helps to quickly find information in a document

B. Points readers to specific page numbers

D. Locates specific sections within a document

4 0
3 years ago
Read 2 more answers
A computer has a pipeline with four stages. each stage takes the same time to do its work, namely, 1 nsec. how many instructions
prisoha [69]

In figuring, a pipeline, otherwise called an information pipeline, is a lot of information preparing components associated in arrangement

Further explanation:

In figuring, a pipeline, otherwise called an information pipeline, is a lot of information preparing components associated in arrangement, where the yield of one component is the contribution of the following one. The components of a pipeline are frequently executed in parallel or in time-cut style.

Instruction travelling:

999,999,997 guidelines for each second. The pipeline has 3 nsec of straightforward figurings, at that point finishes a guidance in each ensuing nsec.  

3nsec (for first guidance to go down the pipeline).10^9 ns every second. 10^9 – 3 = 999999997 directions.

Instruction per second:

MIPS - Million guidelines for each second  

Million guidelines for each second (MIPS) is a more established, outdated proportion of a PC's speed and power, MIPS measures generally the quantity of machine directions that a PC can execute in one second.

Per second:

Million directions for each second (MIPS) is a more established, old proportion of a PC's speed and power, MIPS measures generally the quantity of machine guidelines that a PC can execute in one second. Be that as it may, various directions require pretty much time than others, and there is no standard strategy for estimating MIPS. Moreover, MIPS alludes just to the CPU speed, while genuine applications are commonly constrained by different elements, for example, I/O speed

Answer Details:

Subject: Computer and technology

Level: College.

Key Words:

Further explanation:

Per second:

Instruction per second:

Instruction travelling:

For further Evaluation:

brainly.com/question/6362387

brainly.com/question/12938965

6 0
3 years ago
Read 2 more answers
How to remove duplicates from list in python?
kondaur [170]
<span> the new way of </span>removing duplicates<span> from an iterable while keeping it in the original order </span>
5 0
3 years ago
Read 2 more answers
What is curated content?
disa [49]

Answer:

Content from the web that has been sorted through and shared on a brand’s digital platforms.

Explanation:

This type of content is created by other organizations but shared by a brand because they believe it will be of interest to their audience.

RIP 999

6 0
2 years ago
Other questions:
  • An example of an email client is:<br> A.)Yahoo<br> B.)Gmail<br> C.)Outlook<br> D.)All of the Above
    9·1 answer
  • Which statement is true about parity in RAM?
    11·1 answer
  • Which of these expressions evaluates to 4.0?
    12·2 answers
  • Emilio is reviewing the data he collected from historical records about immigration in the united states. He decides to create a
    5·1 answer
  • What does the headgear of a mine do
    6·2 answers
  • What are the three default security levels within software restriction policies?
    12·1 answer
  • What are the consequences of plagiarism?
    7·2 answers
  • 1. A database table can hold ??
    9·1 answer
  • Why can't this app have people ask riddles.
    8·1 answer
  • Which for loop syntax is correct?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!