Euclid program Programming Software Development by gunneronaspooky …'s what i have so far [CODE]print "Euclid's Method" a= raw_input(("Enter first number …")) b= raw_input(("Enter second number ")) def euclid(a,b): while b != 0: a, b = b, … File "C:/Users/Tony/Documents/Module 2/euclid", line 9, in euclid a, b = b, a%b TypeError: … Re: Euclid program Programming Software Development by TrustyTony do euclid(int(a), int(b)) Euclid gcd Programming Software Development by jimJohnson …n", counter); //CALL EUCLAID printf ("Call Euclid\n"); gcd(firstRandomNumber, secondRandomNumber); //OUTPUT OF … that computes the greatest common divisor using Euclid’s algorithm. Your program is to create…of random numbers selected by thread one. Euclid’s Algorithm Definition: An algorithm to compute… Euclid Question Programming Software Development by NexG This is my attempt at the Euclid Algorithm. I would like it if someone could give me …. It compiles fine. [CODE]import java.util.Scanner; public class Euclid{ public static void main(String[] args){ Scanner scanner = new Scanner… Euclid gcd Programming Software Development by jimJohnson … %d\n", counter); //CALL EUCLAID //Changed printf ("Call Euclid\n"); //changed gcd(firstRandomNumber, secondRandomNumber); //changed //OUTPUT OF EUCLAID… Re: Euclid gcd Programming Software Development by jimJohnson … %d\n", counter); //CALL EUCLAID //Changed printf ("Call Euclid\n"); //changed cout << firstRandomNumber << secondRandomNumber… Solving the greatest common divisor using C++ and the Euclid method Programming Software Development by qqwushi12345 Solving the greatest common divisor using C++ and the Euclid method Below is my code: #include "stdafx.h" #… Re: Euclid program Programming Software Development by gunneronaspooky for the def, print, or both? Re: Euclid program Programming Software Development by Beat_Slayer The print, one place is enough. Cheers and Happy coding Re: Euclid program Programming Software Development by gunneronaspooky … what I need to do... Write a function that implements Euclid’s method for finding a common factor of two numbers… Re: Euclid program Programming Software Development by TrustyTony Return must not be inside the while but after exit from while. Re: Euclid program Programming Software Development by gunneronaspooky Thanks. I fixed it. You guys are a ton of help. I appreciate it a lot. Re: Euclid gcd Programming Software Development by nezachem Line 52: you do not return anything from the [ICODE]else[/ICODE] clause. Didn't the compiler warn you? Re: Euclid gcd Programming Software Development by jimJohnson this is what I put for a return but I am guessing this is wrong... [CODE] int gcd (int firstRandomNumber, int secondRandomNumber) { if (secondRandomNumber==0) { return firstRandomNumber; } else { gcd (secondRandomNumber, firstRandomNumber % secondRandomNumber); return secondRandomNumber; } } [/CODE] Re: Euclid gcd Programming Software Development by frogboy77 simple gcd [CODE]int g_c_d(int a,int b) { if(b==0){return a;} else{return g_c_d(b,a%b);} }[/CODE] Re: Euclid gcd Programming Software Development by jimJohnson I apologize for responding again but I put the following in and it still returns 0... [CODE] int gcd (int firstRandomNumber, int secondRandomNumber) { if (secondRandomNumber==0) { return firstRandomNumber; } else { return gcd (secondRandomNumber, firstRandomNumber % secondRandomNumber); } } [/CODE] Re: Euclid gcd Programming Software Development by nezachem I don't believe you: [CODE]nezachem@ ~/projects/dany $ cat gcd.c #include <stdio.h> int gcd (int firstRandomNumber, int secondRandomNumber) { if (secondRandomNumber==0) { return firstRandomNumber; } else { return gcd (secondRandomNumber, firstRandomNumber % secondRandomNumber); } } int main()… Re: Euclid gcd Programming Software Development by jimJohnson When I put those numbers in I do get 3 and 6 to return as the random numbers but I need to pass the first and second random number so since it works when I enter the following... [CODE] printf("Greatest common divisior (GCD) is %d\n", gcd(3,6)) [/CODE] but does not work when I enter... [CODE] printf("Greatest common divisior (… Re: Euclid gcd Programming Software Development by nezachem So now we agree that gdc works fine, and a problem is somewhere else.Correct me if I am wrong, but there's nothing in your code which would assign any value to firstRandomNumber (or secondRandomNumber). I am talking about the shared global variables, declared at lines 18 and 19. PS: didn't your compiler warn you that a formal parameter shadows a … Re: Euclid gcd Programming Software Development by jimJohnson Yes also when I change the global variables at the top from 0 to say like 10 the gcd changes as well to whatever is put in if that makes sense Re: Euclid Question Programming Software Development by crazins gotta be honest im not finding anything wrong with it? can you give me two numbers that would cause something to go wrong? Re: Euclid Question Programming Software Development by NexG I tested 25 and 4. Re: Euclid gcd Programming Software Development by iamthwee Ah the pitfalls of debugging a multi-threaded program. Re: Euclid gcd Programming Software Development by jimJohnson yea i cant really debug this Re: Euclid gcd Programming Software Development by Mouche You're getting zero for gcd() because you never assign anything to firstRandomNumber or secondRandomNumber except when you first initialize them to 0. Re: Euclid gcd Programming Software Development by jimJohnson In the second post I am getting a number returned just not the correct one Re: Euclid gcd Programming Software Development by Mouche For one, line 56 is missing "gcd". Re: Euclid gcd Programming Software Development by jimJohnson I changed the name because gcd is the name of the function Re: Euclid gcd Programming Software Development by Mouche I was saying you have this: [CODE]int x = (secondRandomNumber, firstRandomNumber % secondRandomNumber);[/CODE] instead of this: [CODE]int x = gcd(secondRandomNumber, firstRandomNumber % secondRandomNumber);[/CODE] Re: Euclid gcd Programming Software Development by jimJohnson o im sorry about that