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
dem82 [27]
3 years ago
8

For two integers m and n, their GCD(Greatest Common Divisor) can be computed by a recursive function. Write a recursive method g

cd(m,n) to find their Greatest Common Divisor. Once m is 0, the function returns n. Once n is 0, the function returns m. If neither is 0, the function can recursively calculate the Greatest Common Divisor with two smaller parameters: One is n, the second one is m mod n. Although there are other approaches to calculate Greatest Common Divisor, your program should follow the instructions of this question, otherwise you will not get the credit. Then write a testing program to call the recursive method.
Computers and Technology
1 answer:
konstantin123 [22]3 years ago
6 0

Answer:

In Python:

def gcd(m,n):

if n == 0:

 return m

elif m == 0:

    return n

else:

 return gcd(n,m%n)

Explanation:

This defines the function

def gcd(m,n):

If n is 0, return m

<em> if n == 0: </em>

<em>  return m </em>

If m is 0, return n

<em> elif m == 0: </em>

<em>     return n </em>

If otherwise, calculate the gcd recursively

<em> else: </em>

<em>  return gcd(n,m%n)</em>

<em />

<em>To call the function to calculate the gcd of say 15 and 5 from main, use:</em>

<em>gcd(15,5)</em>

You might be interested in
A cloud file system (CFS) allows users or applications to directly manipulate files that reside on the cloud.
Mademuasel [1]

Answer:

True is the correct answer for the above question.

Explanation:

A CFS(cloud file system) is used to create a spoke and hub method for the data distribution in which hub is a storage area situated on the central part of the cloud system. It is located in a public cloud provider like AWS.

It uses to manipulate the file for the purpose of data distribution so that it can store the file on the cloud easily with the available some spaces only.

It provides access to the user that they can manipulate the file for their needs if the files are available on the cloud.

The question scenario also states the same which is described above hence It is a true statement.

5 0
2 years ago
A (n) ___ system can help a business alleviate the need for multiple information systems.
BigorU [14]

Answer:

Enterprise Resource Planning

Explanation:

ERP

3 0
3 years ago
A lever has an effort arm that is 8 meters long and the residence (load) arm that is 1.5 meters long, how much effort is needed
andrew11 [14]

Answer:

1066.67 N

Explanation:

Given that two measurements of the arm and an input weight. To answer this problem,we need to balance the forces and use the lengths of the arms. 

Force × effort of arm distance= input weight × load distance

200 N * 8 m = x * 1.5 m

1600 = 1.5x

x = 1600/1.5

x = 1066.666 N

it takes 1066.67 N to lift the input weight

4 0
3 years ago
What safety do you need to have ready to start a device repair?
lorasvet [3.4K]

Answer:

Make sure to have the right tools for the right job. if you don't it would be probably best to send it to a shop to get fixed.

7 0
2 years ago
We use a cubic equation in which the variables and coefficients all take on values in the set of integers from 0 through p - 1 a
dezoksy [38]

Answer:

We use a cubic equation in which the variables and coefficients all take on values in the set of integers from 0 through p - 1 and in which calculations are performed modulo p for a __Prime Curve_ over Zp.

Explanation:

Two families of elliptic curves are used in cryptographic applications

  1. Binary curves over GF(2m):
  2. Prime Curves over Zp.
4 0
2 years ago
Other questions:
  • In three to five sentences, explain how you would insert graphics using your word-processing software.
    7·2 answers
  • In ssl/tls, a specific set of protocols that a particular cryptographic system will use to provide protection is called a ______
    5·1 answer
  • Write down the pseudo code of a program that calculates the Body Mass Index (BMI) of
    9·1 answer
  • What percentage of people with internet access use emojis?
    11·1 answer
  • Cognitive psychology is the scientific study of what
    9·1 answer
  • Multiple client switches and routers have been set up at a small military base. The network team decided to implement Terminal A
    15·1 answer
  • Which statement is true about the purpose of a work in process constraint?
    15·1 answer
  • How are logical operators used?
    14·1 answer
  • Write any four difference between email and effects​
    14·1 answer
  • Breaking code rules is only a problem once in a while. Group of answer choices True False
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!