JavaScript Program to find quotient and remainder

In this program, you will learn how to find quotient and remainder in JavaScript.


q = x / y
r = x % y

JavaScript Program to find quotient and remainder

Example: How to find quotient and remainder in JavaScript

let x = prompt("Enter first number")
let y = prompt("Enter second number")

q = x / y
r = x % y

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

Output:

Enter first number> 5
Enter second number> 3
Quotient is:1.6666666666666667
Remainder is2