Home >>VB.Net Built-in Functions >VB.Net program to demonstrate the Fix() function

VB.Net program to demonstrate the Fix() function

Write a VB.Net program to demonstrate the Fix() function

To get the integer portion from the specified double number, the Fix() function is used.

Syntax :

Fix(val)

Parameters :

  • num: Double number, specified.

Return Value :

The Fix() function returns the integer portion of the number given.

Program :

Below is the source code for demonstrating the Fix() function. The program given is compiled and successfully executed.


Module Module1
    Sub Main()
        Dim val As Double = 32.53
        Dim ret As Double = 0
        ret = Fix(val)
        Console.WriteLine("Result: {0}", ret)
    End Sub
End Module
	
Output:
Result: 32

Explanation:

We created a Module1 module in the program above that contains the Main() method. We created two variables, val and ret, in the Main() method. Variable val is initialized to 32.53 here, and variable ret is initialized to 0.

ret = Fix(val)

We used the Fix() function in the code above, which will return the integer portion of the given number. Then, on the console screen, we printed a character.