128
Write a Program to find the Perimeter of Ellipse
Before writing the program of calculating the perimeter of an ellipse in different programming languages, firstly we have to know about what is ellipse and its perimeter’s formula.
What is Ellipse?
An ellipse is described as a curve on a plane that surrounds two focal points such that the sum of the distances to the two focal points is constant for every point on the curve.
Perimeter of Ellipse
Perimeter of Ellipse = 2 * π * sqrt( (a2 + b2) / 2 ) Where, a is the semi-major axis of an ellipse, b is the semi-minor axis of the same ellipse, and the value of π is 3.14.
Program of calculating the perimeter of an ellipse in different Programming languages
Program 1: Write a Program in C language:
Output of Above C program:
Enter the semi-major axis of the ellipse:5 Enter the semi-minor axis of the ellipse:10 Perimeter of the ellipse is: 49.647758
Program 2: Write a Program in Java language:
Output of Above Java program:
The Perimeter of a ellipse is: 49.647759264643554
Program 3: Write a Program in PHP programming language.
Output of Above PHP program:
49.647759264644
Program 4: Write a Program in Python programming language.
Output of Above Python program:
49.647759264644