Home »
VB.Net »
VB.Net Programs
VB.Net program to demonstrate the Oct() function
By Nidhi Last Updated : November 13, 2024
Oct() function in VB.Net
The Oct() function is used to get the Octal value corresponding specified number.
Syntax
Oct(num)
Parameter(s)
- num: Specified integer number.
Return Value
The Oct() function will return the Octal value corresponding specified integer number.
VB.Net code to demonstrate the example of Oct() function
The source code to demonstrate the Oct() function is given below. The given program is compiled and executed successfully.
'VB.Net program to demonstrate the Oct() function.
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
Output:
Octal value: 15
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 OctalVal. Here, variable val is initialized with 13 and variable OctalVal is initialized with a blank string.
OctalVal = Oct(val)
In the above code, we used Oct() function that will return the octal value corresponding to the specified integer number. Then we printed the character on the console screen.
VB.Net Basic Programs »