# Using Round function in C# and VB.Net

## Last Reply on Dec 26, 2017 11:48 PM By kalpesh

Posted on Dec 26, 2017 11:12 PM

the pointable value grether then 0 then i want to value = value+1

var a=12.10;

var b=12.1;

var c=12.50

var d=12.00

resultA=13;

resultB=13;

resultC=13;

resultd=12;

how to use round function ??

Posted on Dec 26, 2017 11:20 PM Modified on on Dec 26, 2017 11:33 PM

Posted on Dec 26, 2017 11:29 PM

`Use Math.Round()   function to find round value.`

Posted on Dec 26, 2017 11:48 PM

Refer the below sample code for your reference and implement it as per your code logic.

C#

```var testValue = 12.10;
int result;
int number = Convert.ToInt32(testValue.ToString().Split('.')[0]);
int decimalPointvalue = testValue.ToString().Split('.').Length > 1 ? Convert.ToInt32(testValue.ToString().Split('.')[1]) > 0 ? Convert.ToInt32(testValue.ToString().Split('.')[1]) : 0 : 0;
result = number + decimalPointvalue;```

VB.Net

```Dim testValue = 12.10
Dim result As Integer
Dim number As Integer = Convert.ToInt32(testValue.ToString().Split("."c)(0))
Dim decimalPointvalue As Integer = If(testValue.ToString().Split("."c).Length > 1, If(Convert.ToInt32(testValue.ToString().Split("."c)(1)) > 0, Convert.ToInt32(testValue.ToString().Split("."c)(1)), 0), 0)
result = number + decimalPointvalue```

Output

13