Home >>VB.Net Built-in Functions >VB.Net program to demonstrate the Oct() function
The Oct() function is used to get the corresponding number of the Octal value defined.
Syntax :
Oct(num)
Parameters :
Return Value :
The Oct() function returns an octal value corresponding to the integer number specified.
Program :
Below is the source code to demonstrate the Oct() function. The program given is compiled and successfully executed.
Module Module1
Sub Main()
Dim val As Integer = 13
Dim OctalVal As String = ""
OctalVal = Oct(val)
Console.WriteLine("Octal value: {0}", OctalVal)
End Sub
End Module
Explanation:
We created a Module1 module in the program above that contains the Main() method. We created two variables, val and OctalVal, in the Main() method. In this case, the variable val is initialized with 13 and the variable OctalVal with a blank string is initialized.
OctalVal = Oct(val)
We used the Oct() function in the above code, which returns an octal value corresponding to the integer number defined. Then, on the console screen, we printed a character.