VB.Net program to demonstrate the Fix() function

Here, we are going to demonstrate the Fix() function in VB.Net.
Submitted by Nidhi, on December 04, 2020 [Last updated : March 05, 2023]

Fix() function in VB.Net

The Fix() function is used to get the integer portion from the specified double number.

Syntax

Fix(val)

Parameter(s)

  • num: Specified double number.

Return Value

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

VB.Net code to demonstrate the example of Fix() function

The source code to demonstrate the Fix() function is given below. The given program is compiled and executed successfully.

'VB.Net program to demonstrate the Fix() function.

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
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains a Main() method. In the Main() method, we created two variables val and ret. Here, variable val is initialized with 32.53 and variable ret is initialized with 0.

ret = Fix(val)

In the above code, we used the Fix() function that will return the integer portion of the given number.

Then we printed the character on the console screen.

VB.Net Basic Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.