var x = 100; var y = 50; var z = x/y
var x = 100; var y = 50.0; var z = x/y
What is an integer?
What are float numbers?
Math.floor(24.1) = 24 and Math.ceil(24.1) = 25.
var x = 100; var y = 50.0; var z = Math.floor(x/y)
The value of z will be 25, which is the closest whole number to the quotient of x/y.
var x = 100; var y = 50.0; var z = Math.ceil(x/y)
The value of z will be 25, which is the closest whole number to the quotient of x/y, rounded up.
Follow us on Facebook