ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

VB.Net program to calculate the perimeter of the circle

Here, we are going to learn how to calculate the perimeter of the circle in VB.Net?
Submitted by Nidhi, on November 26, 2020

Here we will read the radius from the user and calculate the perimeter of the circle. The formula of the perimeter of the circle is given below:
Area = 2 * 3.14 * radius

Program/Source Code:

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

'VB.Net program to calculate the perimeter 
'of the circle.

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
Press any key to continue . . .

Explanation:

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

area = 2 * 3.14F * radius

In the above code, we calculated the perimeter of the circle, here we used the value of PI that is "3.14". After that, we printed the value of perimeter on the console screen.

VB.Net Basic Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.