GCD của hai hoặc nhiều số khác 0 là số lớn nhất chia hết cho cả hai hoặc nhiều số khác 0. Nó là một trong những khái niệm cơ bản của toán học
Ví dụ
Input : 8, 4 Output : 4 Explanation: 8 and 4 are two non-zero numbers which are divided by 2 and also by 4 but 4 is the largest number than 2. So, the GCD of 8 and 4 is 4.
Ở đây, một mảng các số khác 0 sẽ được cung cấp bởi người dùng và chúng ta phải tìm GCD của các phần tử mảng trong Python. Để giải quyết vấn đề này, chúng ta sẽ sử dụng mô-đun toán học của Python. Đây là một trong những mô-đun hữu ích nhất của Python được sử dụng cho các phép toán. Vì vậy, trước khi giải quyết vấn đề này, chúng ta sẽ tìm hiểu cách tìm ƯCLN của hai số khác 0
Chương trình Python để tìm GCD của hai số khác không
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]
đầu ra
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.
Bây giờ, chúng ta đã học cách tìm GTCD của hai số khác 0 nhưng nhiệm vụ chính của chúng ta là tìm GTCD của một phần tử mảng hoặc nhiều hơn hai số khác 0. Vì vậy, chúng ta hãy viết một chương trình Python bằng cách sử dụng các khái niệm trên
Trong ví dụ này, chúng ta sẽ thấy một chương trình Python để tìm HCF của các số đầu vào đã cho. Thừa số chung cao nhất [HCF] của hai hay nhiều số nguyên là số nguyên dương lớn nhất chia hết cho các số đó không dư khi ít nhất một trong các số đã cho khác 0
Ví dụ.
def hcf[x, y]:
if x > y:
smaller = y
else:
smaller = x
for i in range[1,smaller + 1]:
if[[x % i == 0] and [y % i == 0]]:
hcf = i
return hcf
num1 = int[input["Enter first number: "]]
num2 = int[input["Enter second number: "]]
print["The H.C.F. of", num1,"and", num2,"is", hcf[num1, num2]]
Đầu ra.
Nhập số đầu tiên. 24
Nhập số thứ hai. 46
H. C. F. của 24 và 46 là 2
Nhân tử chung cao nhất [H. C. F] hoặc ước chung lớn nhất [G. C. D] trong hai số là số nguyên dương lớn nhất chia hết hai số đã cho. Ví dụ, H. C. F của 12 và 14 là 2
Mã nguồn. Sử dụng vòng lặp
# Python program to find H.C.F of two numbers
# define a function
def compute_hcf[x, y]:
# choose the smaller number
if x > y:
smaller = y
else:
smaller = x
for i in range[1, smaller+1]:
if[[x % i == 0] and [y % i == 0]]:
hcf = i
return hcf
num1 = 54
num2 = 24
print["The H.C.F. is", compute_hcf[num1, num2]]
đầu ra
The H.C.F. is 6
Ở đây, hai số nguyên được lưu trong biến num1 và num2 được truyền cho hàm compute_hcf[]
. Hàm tính H. C. F. hai số này và trả về nó
Trong hàm, trước tiên chúng ta xác định số nhỏ hơn trong hai số kể từ H. C. F chỉ có thể nhỏ hơn hoặc bằng số nhỏ nhất. Sau đó, chúng tôi sử dụng vòng lặp for
để đi từ 1 đến số đó
Trong mỗi lần lặp lại, chúng tôi kiểm tra xem số của chúng tôi có chia hoàn toàn cho cả hai số đầu vào không. Nếu vậy, chúng tôi lưu trữ số dưới dạng H. C. F. Khi hoàn thành vòng lặp, chúng tôi kết thúc với số lớn nhất chia hoàn hảo cả hai số
Phương pháp trên dễ hiểu và dễ thực hiện nhưng không hiệu quả. Một phương pháp hiệu quả hơn nhiều để tìm H. C. F. là thuật toán Euclide
thuật toán Euclide
Thuật toán này dựa trên thực tế là H. C. F. của hai số cũng chia hết hiệu của chúng
Trong thuật toán này, chúng ta chia số lớn hơn cho số nhỏ hơn và lấy phần còn lại. Bây giờ, chia nhỏ hơn cho phần còn lại này. Lặp lại cho đến khi phần còn lại là 0
Ví dụ, nếu chúng ta muốn tìm H. C. F. của 54 và 24, ta chia 54 cho 24. Số dư là 6. Bây giờ, chúng ta chia 24 cho 6 và phần còn lại là 0. Do đó, 6 là H cần thiết. C. F
Mã nguồn. Sử dụng thuật toán Euclide
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
Ở đây chúng tôi lặp cho đến khi y trở thành số không. Câu lệnh
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]0 thực hiện hoán đổi giá trị trong Python. Nhấp vào đây để tìm hiểu thêm về hoán đổi biến trong Python
Trong mỗi lần lặp lại, chúng tôi đặt giá trị của y vào x và phần còn lại
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]1 vào y, đồng thời. Khi y trở thành 0, chúng ta có H. C. F. trong x
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]446
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]447
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]449
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]451
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]453
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]455
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]457
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]458
________ 126 ________ 13 ________ 1461
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]46
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]47
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]217
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]470
Python3
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]471
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]472
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]473
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]474
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]475
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]476
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]27
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]479
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]242
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]483
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]40
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]486
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]40
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]489
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]490
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]491
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]492
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]493
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]475
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]495
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]498
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
800# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
802 # importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480 ________ 6804
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]242 _______ 6806
_______126____6808
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]493
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
812# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
814# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
815
_______126____6817
_______126____6819
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
95 # Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
822# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
823 # Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
824compute_hcf[]
96# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]287
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
827# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
802# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
831
_______126____6833
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
835# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
95 # Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
822# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
823 # Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
824compute_hcf[]
96______1287# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
843# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
844 # importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]287
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]483
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]27
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
822# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
850# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
851_______1205____6853
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]27
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
856# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]490
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
822# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]242
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]483
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]205
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
864# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]287
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]205
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]27
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
856# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
870# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
870 # Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
872# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
874________ 1430
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
876 ________ 6870# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
870 ________ 6879# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]287
_______126____6883
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
95 # Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
886# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
823 # Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
888# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
889# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
891# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
892# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]35
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]243
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
896# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]27
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
898# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6901
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6902
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6904
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6906
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]447
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]449
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]451
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]453
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]455
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]448
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]457
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
806# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6920____1480
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6922
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6923
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]492
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]493
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6929
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6930
C#
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6931
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]4
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]69
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6934
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]69
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6936
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]226
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]227
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]20
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]43
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]231
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]20
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]22
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]24
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
________ 126 ________ 127 ________ 128
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]40
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]41
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]40
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]44
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]46
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]47
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]231
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]48
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]49
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6966
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
83# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
86# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
88________ 126 ________ 13 ________ 1691
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]693
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]47
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6982
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6984
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]276
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6982
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6988
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
91# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
93# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
95 compute_hcf[]
96# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]6997
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.690
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.694
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.696
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
95 compute_hcf[]
96# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3
compute_hcf[]
912# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]27
compute_hcf[]
917# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
_______1205____8921
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]205
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]27
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]209
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]430
compute_hcf[]
926# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26____1437
________ 126compute_hcf[]
934 ________ 896
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]3 ________ 6886
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
823 ________ 8939# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
compute_hcf[]
941____135# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]436
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]38
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]439
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]231
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]48
compute_hcf[]
949# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
________ 126 ________ 13 ________ 8953
________ 126 ________ 13 ________ 8956
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]46
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]47
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]217
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
compute_hcf[]
965
Javascript
compute_hcf[]
966
compute_hcf[]
967
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]4
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]20
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]43
compute_hcf[]
971 compute_hcf[]
972
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
________ 126 ________ 127 ________ 128
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]40
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]41
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]40
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]44
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]46
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]47
compute_hcf[]
971 compute_hcf[]
987
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
86# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# Function to find HCF the Using Euclidian algorithm
def compute_hcf[x, y]:
while[y]:
x, y = y, x % y
return x
hcf = compute_hcf[300, 400]
print["The HCF is", hcf]
88# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26____8994
compute_hcf[]
995
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]693
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]47
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6901____1276
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6903
compute_hcf[]
995
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
91# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
93# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
95 Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6911
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.690
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
compute_hcf[]
995
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.694
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.696
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
95 Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6925
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]27
compute_hcf[]
917# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]25
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]205
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]416
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]205
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]27
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6937
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]430
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6939
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
compute_hcf[]
995
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26____1437
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]26
compute_hcf[]
95 Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6949
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]29
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6951______135
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]436
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]45
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]38
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6956
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6957
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]46
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]47
# importing the module import math # input two numbers m,n=map[int,input['Enter two non-zero numbers: '].split[]] #to find GCD g=math.gcd[m,n] # printing the result print['GCD of {} and {} is {}.'.format[m,n,g]]217
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6961
Run 1: Enter two non-zero numbers: 8 4 GCD of 8 and 4 is 4. Run 2: Enter two non-zero numbers: 28 35 GCD of 28 and 35 is 7.6962
đầu ra.
1 2 3 6
Thời gian phức tạp. O[N*log[M]] trong đó N là độ dài của mảng đã cho và M là phần tử lớn nhất trong mảng