Here, a constant PI with a value of 3.14 will be created, and then we will calculate the Circle Area and print the result on the console screen.Program :
The source code to use the const keyword to create a constant is given below. The program given is compiled and successfully executed.
'VB.Net program to create a constant using const keyword.
Module Module1 Sub Main() Const PI As Single = 3.14 Dim AreaOfCircle As Single = 0 Dim Radius As Single = 5 AreaOfCircle = PI * Radius * Radius Console.WriteLine("Area of circle is: " & AreaOfCircle) End Sub End Module
We created a Module1 module in the program above. We created a constant PI here, which is initialized with 3.14, and to calculate the area of the circle, we created three variables. Finally, we printed on the console screen the calculated area of the circle.