About 8,450,000 results
Open links in new tab
  1. JavaScript Program to Find GCD or HCF of Two Numbers

    Mar 5, 2024 · There are several methods that to Find GCD or HCF of Two Numbers in JavaScript, which are listed below: In this approach we are using a for loop to find GCD/HCF, iterating …

  2. JavaScript Program to Find HCF or GCD

    The Highest Common Factor (HCF) or Greatest Common Divisor (GCD) of two integers is the largest integer that can exactly divide both integers (without a remainder). For example, the …

  3. JS how to find the greatest common divisor - Stack Overflow

    Here is a recursive solution, using the Euclidean algorithm. var gcd = function(a, b) { if (!b) { return a; return gcd(b, a % b); Our base case is when b is equal to 0. In this case, we return a. When …

  4. How to calculate greatest common divisor of two or more numbers

    Jan 3, 2023 · In this article, we are given two or more numbers/array of numbers and the task is to find the GCD of the given numbers/array elements in JavaScript. Examples: Input : arr[] = {1, …

  5. JavaScript: Greatest common divisor (gcd) of two integers

    Mar 1, 2025 · Write a JavaScript function that finds the GCD of two numbers using an iterative approach without recursion. Write a JavaScript function that implements the subtraction-based …

  6. Program to find the GCD of two numbers in javascript.

    Feb 9, 2019 · Learn how to find the gcd of two numbers (euclidean algorithm) in javascript and es6. Implement iterative as well recursive algorithm.

  7. JavaScript Program to Find G.C.D Using Recursion

    Mar 8, 2024 · This approach offers a clear and concise solution leveraging the power of recursion in JavaScript. Example: To demonstrate finding the greatest common divisor (G.C.D) of two …

  8. How to find GCD in JavaScript? [SOLVED] - GoLinuxCloud

    Dec 9, 2022 · There are several ways to find the GCD of two or more numbers in JavaScript. You can use the gcd method of the mathjs library, you can use a recursive function, or you can use …

  9. Calculate GCD of Two or More Numbers in JavaScript

    Jul 1, 2022 · Learn how to calculate the GCD (Greatest Common Divisor) of two or more numbers using arrays in JavaScript with this comprehensive guide.

  10. JavaScript: Find the greatest common divisor of two positive numbers

    Feb 28, 2025 · Write a JavaScript function that finds the greatest common divisor of two numbers using the Euclidean algorithm recursively. Write a JavaScript function that computes the GCD …

  11. Some results have been removed
Refresh