Skip to content

Latest commit

 

History

History

Day 32

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Write a program to find the greatest common divisor (gcd) of two positive numbers

Instruction

  • The greatest common divisor (GCD), also called the greatest common factor, of two numbers is the largest number that divides them both. For instance, the greatest common factor of 20 and 15 is 5, since 5 divides both 20 and 15 and no larger number has this property.

Challenges (0/3 done)

  • gcd(2154, 458)
  • gcd(12, 4)
  • gcd(333, 3333)
function gcd(a, b) {
	// write your code here
	return
}

const a = 2154
const b = 458

console.log("The GCD of " + a + " ", b + " is " + gcd(a, b));