freeCodeCamp/curriculum/challenges/arabic/08-coding-interview-prep/rosetta-code/greatest-common-divisor.ara...

1.3 KiB

title id challengeType videoUrl localeTitle
Greatest common divisor 5a23c84252665b21eecc7e82 5

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert(typeof gcd=="function","<code>gcd</code> should be a function.");'
  - text: ''
    testString: 'assert(typeof gcd(24,36)=="number","<code>gcd(24,36)</code> should return a number.");'
  - text: ''
    testString: 'assert.equal(gcd(24,36),12,"<code>gcd(24,36)</code> should return <code>12</code>.");'
  - text: ''
    testString: 'assert.equal(gcd(30,48),6,"<code>gcd(30,48)</code> should return <code>6</code>.");'
  - text: ''
    testString: 'assert.equal(gcd(10,15),5,"<code>gcd(10,15)</code> should return <code>5</code>.");'
  - text: ''
    testString: 'assert.equal(gcd(100,25),25,"<code>gcd(100,25)</code> should return <code>25</code>.");'
  - text: ''
    testString: 'assert.equal(gcd(13,250),1,"<code>gcd(13,250)</code> should return <code>1</code>.");'
  - text: ''
    testString: 'assert.equal(gcd(1300,250),50,"<code>gcd(1300,250)</code> should return <code>50</code>.");'

Challenge Seed

function gcd(a, b) {
  // Good luck!
}

Solution

// solution required