圆形扇区或圆形扇区是磁盘的两个半径和弧线所包围的部分,其中较小的区域称为次要扇区,较大的区域称为主扇区。让我们看一下这个图并尝试找出该扇区:
在此图中,绿色阴影部分是一个扇形,“ r”是半径,“ theta”是角度,如图所示。在这里,我们可以说阴影部分是次要部分,其他部分是主要部分。 “ L”是扇形的弧线。有关更多信息,请访问部门。
现在让我们看一下可以用来计算圆的扇形的公式。
扇形的面积类似于圆的面积的计算,只是将圆的面积乘以扇形的角度即可。
例子:
Input:
radius = 9
angle = 60
Explanation:
Sector = ( pi * 9*9 ) * ( 60 / 360 )
Output: 42.42857142857142
Input:
radius = 20
angle = 145
Explanation:
Sector = ( pi * 20*20 ) * ( 145 / 360 )
Output: 506.3492063492063
C++
// C++ program to find Area of a Sector
#include
using namespace std;
void SectorArea(double radius,double angle)
{
if(angle >= 360)
cout<<"Angle not possible";
// Calculating area of the sector
else
{
double sector = ((22 * radius * radius) / 7)
* (angle / 360);
cout<
Java
// Java program to find Area of a Sector
class GFG
{
static void SectorArea(double radius,double angle)
{
if(angle >= 360)
System.out.println("Angle not possible");
// Calculating area of the sector
else
{
double sector =((22 * radius * radius) / 7)
* (angle / 360);
System.out.println(sector);
}
}
// Driver code
public static void main (String[] args)
{
double radius = 9;
double angle = 60;
SectorArea(radius, angle);
}
}
// This code is contributed by Anant Agarwal.
Python3
# Python program to find Area of a Sector
def SectorArea(radius, angle):
pi = 22 / 7
# Constraint or Limit
if angle >= 360:
print("Angle not possible")
return
# Calculating area of the sector
else:
sector = (pi * radius ** 2) * (angle / 360)
print(sector)
return
# Driver code
radius = 9
angle = 60
SectorArea(radius, angle)
C#
// C# program to find Area of a Sector
using System;
class GFG {
static void SectorArea(double radius, double angle)
{
if (angle >= 360)
Console.WriteLine("Angle not possible");
// Calculating area of the sector
else {
double sector = ((22 * radius * radius) / 7)
* (angle / 360);
Console.WriteLine(sector);
}
}
// Driver code
public static void Main()
{
double radius = 9;
double angle = 60;
SectorArea(radius, angle);
}
}
// This code is contributed by vt_m.
PHP
= 360)
echo("Angle not possible");
// Calculating area of the sector
else
{
$sector = ((22 * $radius * $radius)
/ 7) * ($angle / 360);
echo($sector);
}
}
// Driver code
$radius = 9;
$angle = 60;
SectorArea($radius, $angle);
// This code is contributed by vt_m.
?>
输出:
42.42857142857142
参考:维基百科(循环部门)