Highest common factor hcf or gratest common divisor in javascript

technical talkiess
0

Highest common factor hcf or gratest common divisor in javascript 


<script>

let vishal;

const a = parseInt(prompt("Enter the first number"));

const b = parseInt(prompt("Enter the Second number"));


for(var i=1;i<=a && i<=b ; i++){

if(a % i ==0 && b % i ==0){

vishal =i;

}


}

alert(vishal);

</script>

Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)