Excuse my lack of expertise in this area. I recently asked a question about rounding off numbers to two decimal places. Now, how can I calculate the sum of these numbers but display only the two decimals without rounding them off? I am working with JavaScript.
For example: 12.876 + 36.278 = 49.154. I want the answer to be... 49.15 only. Or another example: 12.876 + 1 = 13.876. I need the answer to be... 13.87
Below is my current code (which rounds off to two decimal places)
function civ(){
civ1=Number(document.addition.scc.value);
civ2=Number(document.addition.ccc.value);
civ3=Number(document.addition.ncc.value);
civ4=Number(document.addition.vch.value);
civ5=Number(document.addition.mch.value);
civ6=Number(document.addition.nlch.value);
civ7=Number(document.addition.slch.value);
valNum1=Math.round((civ1+civ2+civ3+civ4+civ5+civ6+civ7)*10)/10;
document.addition.civ123.value=valNum1;
}
Gratitude to everyone who assists me regularly! :)