I would like to know why there is always some difference in value, when I perform the below calculations.
var amt=1000;
var cr= 3.02;
var net = (cr/100)*amt;
console.log(net); //shows 29.02 instead of 30.02
I would like to know why there is always some difference in value, when I perform the below calculations.
var amt=1000;
var cr= 3.02;
var net = (cr/100)*amt;
console.log(net); //shows 29.02 instead of 30.02
You can do *
before /
.
var amt = 1000;
var cr = 3.02;
var net = cr * amt / 100;
console.log(net);