C Program to Calculate Area of an Ellipse

This C program calculates are of an ellipse given length of major axis and minor axis.

In mathematics, ellipse is a regular oval shape which is traced by a point moving in a plane such that the sum of its distances from two other points known as foci is constant.

Given length of major axis and minor axis, area of an ellipse is calculated using following formula:

Area of an ellipse = π * major axis length * minor axis length

C Source Code: Ellipse Area


#include<stdio.h>
#define PI 3.141592

int main()
{
    float major, minor, area;

    /* Reading length of major axis */
    printf("Enter length of major axis: ");
    scanf("%f", &major);

    /* Reading length of minor axis */
    printf("Enter length of minor axis: ");
    scanf("%f", &minor);

    /* Calculating area of an ellipse */
    area = PI * major * minor;

    /* Displaying result */
    printf("Area of an ellipse = %0.4f", area);

    return 0;
}

Output

Enter length of major axis: 8
Enter length of minor axis: 4
Area of an ellipse = 100.5309