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

VB.Net program to calculate the perimeter of the circle

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

Here we can read from the user the radius and calculate the circle perimeter. The formula for the circle's perimeter is given below :

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

Program :

The source code for calculating the circle's perimeter is given below. The program given is compiled and successfully executed.

Example


Module Module1

    Sub Main()

        Dim radius As Single = 0.0F
        Dim perimeter As Single = 0.0F

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

        perimeter = 2 * 3.14F * radius

        Console.WriteLine("Perimeter of Circle : {0}", perimeter)
    End Sub
End Module
	
Output:
Enter the radius:3.5
Perimeter of Circle: 21.98

Explanation:

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

area = 2 * 3.14F * radius

We calculated the perimeter 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 perimeter value.


No Sidebar ads