Given the length of the three semi-axes as A, B, and C, the task is to find the surface area of the given Ellipsoid.
Ellipsoid is a closed surface of which all plane cross-sections are either ellipses or circles. An ellipsoid is symmetrical about the three mutually perpendicular axes that intersect at the center. It is a three-dimensional, closed geometric shape, all planar sections of which are ellipses or circles.
An ellipsoid has three independent axes, and is usually specified by the lengths a, b, c of the three semi-axes. If an ellipsoid is made by rotating an ellipse about one of its axes, then two axes of the ellipsoid are the same, and it is called an ellipsoid of revolution, or spheroid. If the lengths of all three of its axes are the same, it is a sphere.
Examples:
Input: A = 1, B = 1, C = 1
Output: 12.57Input: A = 11, B = 12, C = 13
Output: 1807.89
Approach: The given problem can be solved by using the formula for Surface Area of the Ellipsoid as:
Below is the implementation of the above approach:
C++
// C++ program for the above approachÂ
#include <iomanip>#include <iostream>#include <math.h>using namespace std;Â
// Function to find the surface area of// the given Ellipsoidvoid findArea(double a, double b, double c){Â
    // Formula to find surface area    // of an Ellipsoid    double area = 4 * 3.141592653                  * pow((pow(a * b, 1.6) + pow(a * c, 1.6)                         + pow(b * c, 1.6))                            / 3,                        1 / 1.6);Â
    // Print the area    cout << fixed << setprecision(2)         << area;}Â
// Driver Codeint main(){Â Â Â Â double A = 11, B = 12, C = 13;Â Â Â Â findArea(A, B, C);Â
    return 0;} |
Java
// Java program of the above approachimport java.util.*;Â
class GFG{Â
// Function to find the surface area of// the given Ellipsoidstatic void findArea(double a, double b, double c){         // Formula to find surface area    // of an Ellipsoid    double area = 4 * 3.141592653 * Math.pow((Math.pow(a * b, 1.6) +                       Math.pow(a * c, 1.6) + Math.pow(b * c, 1.6)) /                              3, 1 / 1.6);Â
    // Print the area    System.out.print(String.format("%.2f", area));}Â
// Driver Codepublic static void main(String[] args){Â Â Â Â double A = 11, B = 12, C = 13;Â Â Â Â Â Â Â Â Â findArea(A, B, C);}}Â
// This code is contributed by code_hunt |
Python3
# Python3 program for the above approachfrom math import powÂ
# Function to find the surface area of# the given Ellipsoiddef findArea(a, b, c):         # Formula to find surface area    # of an Ellipsoid    area = (4 * 3.141592653 * pow((pow(a * b, 1.6) +            pow(a * c, 1.6) + pow(b * c, 1.6)) / 3, 1 / 1.6))Â
    # Print the area    print("{:.2f}".format(round(area, 2)))Â
# Driver Codeif __name__ == '__main__':Â Â Â Â Â Â Â Â Â A = 11Â Â Â Â B = 12Â Â Â Â C = 13Â Â Â Â Â Â Â Â Â findArea(A, B, C)Â Â Â Â Â # This code is contributed by SURENDRA_GANGWAR |
C#
// C# program of the above approachusing System;Â
class GFG{Â
// Function to find the surface area of// the given Ellipsoidstatic void findArea(double a, double b, double c){         // Formula to find surface area    // of an Ellipsoid    double area = 4 * 3.141592653 * Math.Pow((Math.Pow(a * b, 1.6) +                       Math.Pow(a * c, 1.6) + Math.Pow(b * c, 1.6)) /                              3, 1 / 1.6);Â
    // Print the area    Console.Write(Math.Round(area, 2));}Â
// Driver Codepublic static void Main(String[] args){Â Â Â Â double A = 11, B = 12, C = 13;Â Â Â Â Â Â Â Â Â findArea(A, B, C);}}Â
// This code is contributed by shivanisinghss2110 |
Javascript
<script>        // JavaScript Program to implement        // the above approachÂ
        // Function to find the surface area of        // the given Ellipsoid        function findArea(a, b, c) {Â
            // Formula to find surface area            // of an Ellipsoid            let area = 4 * 3.141592653                * Math.pow((Math.pow(a * b, 1.6) + Math.pow(a * c, 1.6)                    + Math.pow(b * c, 1.6))                    / 3,                    1 / 1.6);Â
            // Print the area            document.write(area.toPrecision(6));        }Â
        // Driver Code        let A = 11, B = 12, C = 13;        findArea(A, B, C);Â
// This code is contributed by Potta Lokesh    </script> |
1807.89
Â
Time Complexity: O(logn) as using inbuilt pow function
Auxiliary Space: O(1)
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 neveropen!

