VB.NET Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Visual Basic Tutorial
Introduction
Installation
Creating Project
Saving a Project
Compile, Run a Project
Open an Existing Project
VB IDE
Forms
VB Datatypes
Constants
Variables
User Defined Datatypes
VB Control Structure
VB Loops
Operators
VB Controls
Dialog Controls
Console Programming
VB Objects,Classes
VB Arrays
Math Functions
String Functions
Type Conversion Functions
Date Time Functions
Databases in VB.net
Enumeration
File Handling
Debugging
Debugging Tools
Exception Handling
Samples
Feedback
 




Math.Round Function in VB.NET

Tutorials Vbnet

Topic

What is Math.Round function in VB.NET?



Explanation
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.

Syntax:
   Math.Round(Number,Decimal Places)

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

Example:
   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))
        Console.ReadLine()
    End Sub
   End Module
Result:
    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.







Other Links

web hosting