考虑到与长度a和半短轴的半长轴的椭圆轴线长度b。任务是找到椭圆的区域。
在数学中,椭圆是平面上由两个焦点围绕的曲线,因此到曲线上的每个点到两个焦点的距离之和是恒定的,或者我们可以说这是圆的推广。
与椭圆有关的要点:
- 中心:椭圆内的一个点,它是连接两个焦点的线段的中点。换句话说,它是短轴和长轴的交点。
- 长轴:椭圆的最长的直径称为长轴。
- 短轴:椭圆的最短直径称为短轴。
- 弦:连接椭圆上任意两个点的线段。
- 焦点:这是定义椭圆的两个固定点。
- 椭圆直肠:穿过椭圆的焦点并垂直于椭圆长轴的线段称为椭圆的椭圆直肠。
椭圆面积:给出椭圆面积的公式如下:
Area = 3.142 * a * b
其中a和b分别是半长轴和半短轴,而3.142是π的值。
例子:
Input : a = 5, b = 4
Output : 62.48
Input : a = 10, b = 5
Output : 157.1
C++
// C++ program to find area of
// an Ellipse.
#include
using namespace std;
// Function to find area of an
// ellipse.
void findArea( float a, float b)
{
float Area;
// formula to find the area
// of an Ellipse.
Area = 3.142 * a * b ;
// Display the result
cout << "Area: " << Area;
}
// Driver code
int main()
{
float a = 5, b = 4;
findArea(a, b);
return 0;
}
Java
// Java program to find area of
// an Ellipse.
class GFG {
// Function to find area of an
// ellipse.
static void findArea( float a, float b)
{
float Area;
// formula to find the area
// of an Ellipse.
Area = (float)3.142 * a * b ;
// Display the result
System.out.println("Area: " + Area);
}
// Driver code
public static void main (String[] args)
{
float a = 5, b = 4;
findArea(a, b);
}
}
Python3
# Python3 program to find
# area of an Ellipse.
# Function to find area
# of an ellipse.
def findArea(a, b):
# formula to find the
# area of an Ellipse.
Area = 3.142 * a * b ;
# Display the result
print("Area:", round(Area, 2));
# Driver code
a = 5;
b = 4;
findArea(a, b);
# This code is contributed
# by mits
C#
// C# program to find area of
// an Ellipse.
using System;
class GFG
{
// Function to find area
// of an ellipse.
static void findArea(float a,
float b)
{
float Area;
// formula to find the
// area of an Ellipse.
Area = (float)3.142 * a * b ;
// Display the result
Console.WriteLine("Area: " +
Area);
}
// Driver code
public static void Main ()
{
float a = 5, b = 4;
findArea(a, b);
}
}
// This code is contributed
// by anuj_67.
PHP
Javascript
输出:
Area: 62.84