Click to See Complete Forum and Search --> : Add two integer but sum should be decimal


Gopinath
06-19-2003, 10:22 PM
I have two integer
let say 12 and 24
when adding it, the sum should be 36.00
help pls:confused:

pyro
06-19-2003, 10:41 PM
You need to use toFixed:

<script type="text/javascript">
num1 = 12;
num2 = 24;

num3 = (num1+num2).toFixed(2);
alert (num3);

</script>