Home >>VB.Net Programs >VB.Net program to calculate the area of the circle

VB.Net program to calculate the area of the circle

Write a VB.Net program to calculate the area of the circle

Here, the user reads the radius and calculates the area of the circle. The formula for the circle's area is given below :

Area = 3.14 * radius * radius
Program/Source Code:

Program :

Below is the source code to calculate the area of the circle. The program given is compiled and successfully executed.

Example


Module Module1

    Sub Main()

        Dim radius As Single = 0.0F
        Dim area As Single = 0.0F

        Console.Write("Enter the radius :")
        radius = Single.Parse(Console.ReadLine())

        area = 3.14F * radius * radius

        Console.WriteLine("Area of Circle : {0}",area)

    End Sub

End Module
	
Output:
Enter the radius :5.2
Area of Circle : 84.90559

Explanation:

We created a Module1 module in the program above that contains the Main() method. We also generated two local radius and area variables in the Main() method, which are initialized with 0.0F. After that, we read from the user the radius value.

area = 3.14F * radius * radius

We calculated the area of the circle in the above code, where we used the PI value that is "3.14" After that, on the console screen, we printed the area's value.


No Sidebar ads