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 = parseInt(prompt("Enter first number"))
let y = parseInt(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