The source code to calculate the perimeter of the Circle is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
//Program to calculate the perimeter of Circle in C#
using System;
class Circle
{
public static int Main()
{
float radius = 0.0F;
float parimeter = 0.0F;
Console.Write("Enter the radius: ");
radius = float.Parse(Console.ReadLine());
parimeter = (float)(2 * Math.PI * radius);
Console.WriteLine("Perimeter of Circle: "+parimeter);
return 0;
}
}
Output:
Enter the radius: 7
Perimeter of Circle: 43.9823
Press any key to continue . . .
Explanation:
Here, we created a class Circle that contains a method Main(). The Main() method is the entry point for the program. Here we read the value of the radius and calculate the perimeter of the Circle using the below formula, and then print the result on the console screen.
Program:
The source code to calculate the perimeter of the Circle is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.
Output:
Explanation:
Here, we created a class Circle that contains a method Main(). The Main() method is the entry point for the program. Here we read the value of the radius and calculate the perimeter of the Circle using the below formula, and then print the result on the console screen.