Tuesday, 21 August 2012

Code to make the Rounding of the 12.5 (Example ) To 13 or 12


// Code to make the Rounding of the  12.5 (Example )  To  13 or  12 

You can specify the behavior of Math.Round using an overload:

Math.Round(2.5, 0, MidpointRounding.AwayFromZero); // gives 3

Math.Round(2.5, 0, MidpointRounding.ToEven); // gives 2

No comments:

Post a Comment