This works:

`inputValue = Math.Round(inputValue, 2); `

ID : 10151

viewed : 69

97

This works:

`inputValue = Math.Round(inputValue, 2); `

89

`Math.Round(inputValue, 2, MidpointRounding.AwayFromZero) `

70

Another easy way is to use ToString with a parameter. Example:

`float d = 54.9700F; string s = d.ToString("N2"); Console.WriteLine(s); `

Result:

`54.97 `

70

You should use

`inputvalue=Math.Round(inputValue, 2, MidpointRounding.AwayFromZero) `

Math.Round rounds a double-precision floating-point value to a specified number of fractional digits.

Specifies how mathematical rounding methods should process a number that is midway between two numbers.

Basically the function above will take your inputvalue and round it to 2 (or whichever number you specify) decimal places. With `MidpointRounding.AwayFromZero`

when a number is halfway between two others, it is rounded toward the **nearest number that is away from zero.** There is also another option you can use that rounds towards the **nearest even number.**

56

Use Math.Round

`value = Math.Round(48.485, 2); `