Issues with Code in GCD of Two Numbers menu

User Tag List

Results 1 to 1 of 1
  1. #1
    sheen8's Avatar Banned
    Reputation
    1
    Join Date
    Mar 2023
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Issues with Code in GCD of Two Numbers

    Hello everyone!

    I am having difficulty understanding the code in this article on the Greatest Common Divisor of two numbers:
    I am trying to implement the Euclidean Algorithm but I am getting an incorrect output. Here is my code:

    HTML Code:
    def gcd(a, b): 
        if b == 0: 
            return a 
        else: 
            return gcd(b, a % b) 
    
    print(gcd(20, 8))
    The output I am getting is 8, when I am expecting 4. Can someone please explain why this is happening and how to fix it?

    Thank you!

    Issues with Code in GCD of Two Numbers

Similar Threads

  1. [Trinity] Issue with Creature_Loot_Template in database?
    By Raskir in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 03-23-2019, 09:35 AM
  2. [Selling] WTS US Battlchest codes in sets of 10+ *5$ per code*
    By lazaraslong in forum WoW-US Account Buy Sell Trade
    Replies: 3
    Last Post: 08-07-2016, 04:52 PM
  3. Having in issue with Nova frames interface menu in some of my chars
    By calamat44 in forum WoW Bots Questions & Requests
    Replies: 0
    Last Post: 04-09-2013, 02:13 PM
  4. Under the mogu statue in Shrine of Two Moons
    By ox0bo in forum World of Warcraft Exploration
    Replies: 0
    Last Post: 10-22-2012, 02:37 PM
  5. In Search of another player or more to exploit with
    By Saintman in forum World of Warcraft General
    Replies: 1
    Last Post: 07-03-2007, 09:17 PM
All times are GMT -5. The time now is 03:46 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search