Removing Decimal Palces from a division
-
Hi I am doing a division and the result gives me an answer with decimal places. How do I remove all the characters after the decimal place?
-
Hi I am doing a division and the result gives me an answer with decimal places. How do I remove all the characters after the decimal place?
-
Hi I am doing a division and the result gives me an answer with decimal places. How do I remove all the characters after the decimal place?
-
Hi I am doing a division and the result gives me an answer with decimal places. How do I remove all the characters after the decimal place?
That depends. Do you want to truncate or round the value? Are you going to process the value further, or is it only to be displayed? If you want to truncate the value (remove decimal part), cast the value to int or use Math.Truncate. If you want to round the value (to nearest integer), use Math.Round. If you want to round it only for displaying it, do the rounding when you convert it to a string, using ToString("n0"). --- b { font-weight: normal; }