Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to find hcf of 2 numbers in javascript

var a = userInput[0].split(" ").map(Number)
while(a[0] != a[1])
{
    if(a[0] > a[1]) { 
        a[0] = a[0] - a[1];
    }
    else {
        a[1] =a[1] - a[0]; 
    }
}
console.log(a[0])
Comment

PREVIOUS NEXT
Code Example
Javascript :: flutter intl currency 
Javascript :: how to check if value is undefines if condition jquery 
Javascript :: render object id in an array reactjs from database 
Javascript :: hmac_sha256 node 
Javascript :: how to capture a thumbnail from a video 
Javascript :: axios send post to php 
Javascript :: how would you check if a number is an integer in javascript 
Javascript :: create angular project 
Javascript :: how to scrape the web with javascript 
Javascript :: Shortest ajax get method jquery 
Javascript :: javascript if string empty 
Javascript :: change css with javascript 
Javascript :: switch in react 
Javascript :: print random string from an array to screen in javascript 
Javascript :: vue js default props 
Javascript :: fromcharcode in javascript 
Javascript :: html close tab 
Javascript :: for loop set timeout 
Javascript :: how to increment counter button click in js 
Javascript :: chartjs each dataset get colors 
Javascript :: expose deployment nodeport command 
Javascript :: nextjs global scss variables 
Javascript :: alpinejs with select 
Javascript :: quasar change port 
Javascript :: change text size according to screen react native 
Javascript :: adding element to javascript object 
Javascript :: mongoose multiple populate 
Javascript :: javascript new date from string dd/mm/yyyy 
Javascript :: mongodb replace string regex 
Javascript :: how to sort an array of object 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =