About 85,900 results
Open links in new tab
  1. Python Program to find GCD of Two Numbers - Tutorial Gateway

    Python Program to find the GCD of Two Numbers using Recursion. It allows the user to enter two positive integer values and calculate the Greatest Common Divisor of those two values by …

  2. Python Program to Find the Gcd of Two Numbers - GeeksforGeeks

    Feb 22, 2025 · The task of finding the GCD (Greatest Common Divisor) of two numbers in Python involves determining the largest number that divides both input values without leaving a …

  3. GCD of Two Numbers in Python using For loop - W3CODEWORLD

    Jan 26, 2023 · In this article, you will learn how to find the gcd of two numbers in python using for loop, recursion, function, and Euclidean Algorithm. GCD = 10. What is GCD of Two Numbers? …

  4. GCD of Two Numbers in Python - PrepInsta

    # Recursive function to return GCD of two number def findGCD(num1, num2): # Everything divides 0 if num1 == 0 or num2 == 0: return num1 + num2 # base case if num1 == num2: …

  5. Python Program to Find HCF or GCD

    In this example, you will learn to find the GCD of two numbers using two different methods: function and loops and, Euclidean algorithm

  6. Python: Greatest common divisor (GCD) of two positive integers

    Apr 16, 2025 · # Define a function to calculate the greatest common divisor (GCD) of two numbers. def gcd(x, y): # Initialize z as the remainder of x divided by y. z = x % y # Use a …

  7. Python Program to Find HCF or GCD of Two Numbers

    Nov 3, 2022 · Let’s use the following algorithm to write a program to find gcd or hcf of two numbers in python: HCF of Two Numbers in Python using While Loop; Python Program to …

  8. Python Program - Find GCD of Two Numbers - Java

    Method 1: Using For Loop to find GCD of two numbers. In the example below, for loop is used to iterate the variable i from 1 to the smaller number. If both numbers are divisible by i, then it …

  9. HCF or GCD of Two Numbers in Python - Know Program

    Python program to find GCD of the two numbers using for loop and if-else statement. smaller = y. else: . smaller = x. # find gcd of the number for i in range (1,smaller+1): if((x % i == 0) and (y % …

  10. Code for Greatest Common Divisor in Python - Stack Overflow

    Jun 24, 2012 · The greatest common divisor (GCD) of a and b is the largest number that divides both of them with no remainder. One way to find the GCD of two numbers is Euclid’s …

Refresh