About 478,000 results
Open links in new tab
  1. Program to Find GCD or HCF of Two Numbers - GeeksforGeeks

    Feb 14, 2025 · Given two numbers a and b, the task is to find the GCD of the two numbers. Note: The GCD (Greatest Common Divisor) or HCF (Highest Common Factor) of two numbers is the …

  2. Python Program to Find HCF or GCD

    # 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) Here we loop until y becomes …

  3. HCF and LCM in Python – Calculating the HCF and LCM using Python

    Jul 31, 2021 · Let’s get right into implementing HCF and LCM in Python code. 1. Finding HCF of two numbers. Let us pass two numbers as input and see what our results come out to be. 2. …

  4. python - Compute the greatest common divisor and least …

    Nov 27, 2022 · You can use Euclidian algorithm if you want to find greatest common divisor or in your terms highest common factor (HCF): here is the link to the article in FreeCodeCamp.org. …

  5. Python Program to Calculate HCF (GCD) & LCM - Codesansar

    This python program calculates Highest Common Factor (HCF) & Lowest Common Multiple (LCM) of two numbers given by user. HCF is also known as Greatest Common Divisor (GCD).

  6. Python Programs to Find HCF and LCM of two numbers - PYnative

    Mar 31, 2025 · In Python, you can use the math module to find the Highest Common Factor (HCF) and the Least Common Multiple (LCM) of two numbers. The math module provides built …

  7. 3 ways in Python to calculate GCD or HCF of two numbers

    Nov 3, 2022 · Python program to calculate GCD or HCF of two user input numbers. Learn how to do it by using a for loop, by reverse looping and by Euclid's division algorithm.

  8. HCF of Two Numbers in Python | Programming in Python

    Here, in this section we will discuss how to find HCF of two numbers in python. HCF means (Highest Common Factor) also known as GCD (Greatest Common Divisor). x is called HCF of …

  9. Write a Python Program to Find HCF (GCD) - pyseek.com

    Feb 6, 2025 · Learn how to find the HCF (GCD) of two numbers in Python using loops, the Euclidean algorithm, and the built-in math.gcd () function.

  10. Python Program to Print HCF of two Numbers Using While Loop

    Here is a program in Python to find the HCF of two numbers using a while loop. if num1 % i == 0 and num2 % i == 0: hcf = i. i += 1. # Check if i divides both num1 and num2. if num1 % i == 0 …

  11. Some results have been removed
Refresh