Respuesta :
Answer:
The following are the program in the Python Programming Language.
#import system
import sys
#define function
def gcd(p,q):
#check that q is equal to 0
if(q==0):
#then, it returns the output
return p
#it returns the common divisor
else:
return gcd(q,p%q)
#get the command-line input
x=sys.argv[1]
#get the command-line input
y=sys.argv[2]
#convert input into the integer
p=int(x)
#convert input into the integer
q=int(y)
#call and print the function
print(gcd(p,q))
Explanation:
The following are the description of the program.
- Firstly, we import the required package and define a function 'gcd()', pass arguments 'p' and 'q' and inside the function.
- Set the if conditional statement to check that the variable 'q' is equal to 0 then, it returns the value of 'q' and otherwise, it returns the greatest common divisor value.
- Finally, we set two variables 'x' and 'y' in which we get input from the command line then, convert the input of the both variable into integer and store them in other variables 'p' and 'q', after all, call and print the following function.