Question

FindGCF.py 1 #The Greatest Common Factor (GCF) of two numbers is the 2 #largest number that divides evenly into those two 3 #
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution

Code

def find_gcf(a,b):
if(b==0):
return a
else:
return find_gcf(b,a%b)
print(find_gcf(48,18))
print(find_gcf(21,7))
print(find_gcf(47,17))

Screenshot and Output

Add a comment
Know the answer?
Add Answer to:
FindGCF.py 1 #The Greatest Common Factor (GCF) of two numbers is the 2 #largest number that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I want the code in C++ The greatest common divisor (GCD) of two integers is the...

    I want the code in C++ The greatest common divisor (GCD) of two integers is the largest integer that evenly divides each of the numbers. Write a function called GCD that has a void return type, and accepts 3 parameters (first two by value, third by reference). The function should find the greatest common divisor of the first two numbers, and have the result as its OUTGOING value. Write a main function that asks the users for two integers, and...

  • In C# write a program for factorizing natural numbers and computing GCF & LCM of two...

    In C# write a program for factorizing natural numbers and computing GCF & LCM of two natural numbers. Users must be promoted to enter two numbers. use class List<>to represent factorizations. Sample Program: Enter first num: 36    Enter second num: 48 Factor of 36 are: 2 2 3 3 Factor of 48 are: 2 2 2 2 3 common factors of 36 & 48 are: 2 2 3 GCF of 36 and 48 is: 12 LCM of 36 and...

  • write code using void function i need the code in C++ but make sire u solve...

    write code using void function i need the code in C++ but make sire u solve by using void function visor (GCD) of two integers is the largest nacd that returns the greatest com- its digits reversed. For example, 5.31 (Greatest Common Divisor) The greatest common divisor (GCD) of two in integer that evenly divides each of the numbers. Write a function gcd that returns the mon divisor of two integers. . . for Numeric Grades) Write a function qualityPoints...

  • IN PYTHON Write a recursive function for Euclid's algorithm to find the greatest common divisor (gcd)...

    IN PYTHON Write a recursive function for Euclid's algorithm to find the greatest common divisor (gcd) of two positive integers. gcd is the largest integer that divides evenly into both of them. For example, the gcd(102, 68) = 34. You may recall learning about the greatest common divisor when you learned to reduce fractions. For example, we can simplify 68/102 to 2/3 by dividing both numerator and denominator by 34, their gcd. Finding the gcd of huge numbers is an...

  • Solve the following question using Matlab language only. Least common multiple (LCM) of two numbers is...

    Solve the following question using Matlab language only. Least common multiple (LCM) of two numbers is the smallest number that they both divide. For example, the LCM of 2 and 3 is 6, as both numbers can evenly divide the number 6. Find the LCM of two numbers using recursion Hint: You may assume that the first number is always smaller than the second number. Examplel First number for LCM:3 Second number for LCM 19 The LCM of 3 and...

  • PYTHON In mathematics, the Greatest Common Divisor (GCD) of two integers is the largest positive integer...

    PYTHON In mathematics, the Greatest Common Divisor (GCD) of two integers is the largest positive integer that divides the two numbers without a remainder. For example, the GCD of 8 and 12 is 4. Steps to calculate the GCD of two positive integers a,b using the Binary method is given below: Input: a, b integers If a<=0 or b<=0, then Return 0 Else, d = 0 while a and b are both even do a = a/2 b = b/2...

  • C++ Part1: Palindrome detector Write a program that will test if some string is a palindrome...

    C++ Part1: Palindrome detector Write a program that will test if some string is a palindrome Ask the user to enter a string Pass the string to a Boolean function that uses recursion to determine if something is a palindrome or not. The function should return true if the string is a palindrome and false if the string is not a palindrome. Main displays the result ( if the string is a palindrome or not Part 2: Compute the Greatest...

  • C++ I do not understand this problem. 14THE GREATEST COMMON DENOMINATOR PROBLEM Write a function named...

    C++ I do not understand this problem. 14THE GREATEST COMMON DENOMINATOR PROBLEM Write a function named god() that accepts two integers as input parameters and returns the greatest common divisor of the two numbers. The greatest common divisor (GCD) of two integers, a and b, is the largest integer that is a factor of both a and b. The GCD of any number and 1 is 1, and the GCD of any number and o is that number. One efficient...

  • coding in c programming Functions & Arrays Q1) The greatest common divisor (GCD) of two Integers...

    coding in c programming Functions & Arrays Q1) The greatest common divisor (GCD) of two Integers (of which at least one is nonzero) is the largest positive integer that divides the numbers. Write a C function ged that accepts two integers and returns 1 if both the integers are zero, otherwise it returns their GCD. Write a C program (that includes the function ged) which accepts two integers and prints their GCD. Sample output: Enter two integers: 0 0 At...

  • 17. Prime Numbers A prime number is a number that is only evenly divisible by itself...

    17. Prime Numbers A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and S. The number 6, how- ever, is not prime because it can be divided evenly by 1, 2, 3, and 6. Write a Boolean function named is_prime which takes an integer as an argument and returns true if the argument is a prime number, or...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT