Math.Round Function in VB.NET

What is Math.Round function in VB.NET?


Math.Round Function

Math.Round in VB.NET is a mathematical function that is used to return whole number nearest to value for the specified number of decimal places.

Math.Round(Number,Decimal Places)

In the above syntax Number is the number to be rounded to the number of Decimal Places.

Module Module1
Sub Main()
Console.WriteLine("Rounded value of 6.42::"
& Math.Round(6.42, 1))
Console.WriteLine("Rounded value of 6.56::"
& Math.Round(6.56, 1))
Console.WriteLine("Rounded value of 6.49::"
& Math.Round(6.49, 1))
End Sub
End Module

Rounded value of 6.42:: 6.4
Rounded value of 6.56:: 6.6
Rounded value of 6.49:: 6.5

In the above example, the Math.Round mathematical function is used to round the decimal number for a single decimal place.

Visual Basic Tutorial

Ask Questions

Ask Question