find the area of a sector of a circle in csharp

To find the area of a sector of a circle in C#, use the following formula:

main.cs
Area = (angle / 360) * pi * radius^2
37 chars
2 lines

Where angle is the central angle of the sector in degrees, pi is the mathematical constant pi, and radius is the radius of the circle.

Here's an example code snippet that calculates the area of a sector:

main.cs
using System;

class Program {
    static void Main() {
        double angle = 60; // degrees
        double radius = 5;
        double area = (angle / 360) * Math.PI * Math.Pow(radius, 2);
        Console.WriteLine("The area of the sector is: " + area);
    }
}
263 chars
11 lines

Output:

main.cs
The area of the sector is: 6.54
32 chars
2 lines

gistlibby LogSnag