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>
Thanks you for commenting your questions. I will see question and respond you.