JavaScript Program to find quotient without using the division operator

In this program, you will learn how to find a quotient without using the division operator in JavaScript.


while (x >= y) {
  x = x - y
  q++
}

JavaScript Program to find quotient without using the division operator

Example: How to find a quotient without using the division operator in JavaScript

let x = prompt("Enter first number")
let y = prompt("Enter second number")
let q = 0
while (x >= y) {
  x = x - y
  q++
}

console.log("Quotient is:" + q)

Output:

Enter first number> 100
Enter second number> 10
Quotient is:10