The Wayback Machine - https://web.archive.org/web/20241001203115/https://www.geeksforgeeks.org/program-calculate-volume-ellipsoid/
Open In App

Program to calculate volume of Ellipsoid

Last Updated : 17 Feb, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Ellipsoid, closed surface of which all plane cross sections are either ellipses or circles. An ellipsoid is symmetrical about 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. 
 

Standard equation of Ellipsoid :
x2 / a2 + y2 / b2 + z2 / c2 = 1
   
where a, b, c are positive real numbers.
Volume of Ellipsoid :  (4/3) * pi * r1 * r2 * r3 

 

Below is code for calculating volume of ellipsoid :
 

C++





Java





Python





C#




// C# program to find the
// volume of Ellipsoid.
using System;
  
class GfG
{
      
    // Function to find the volume
    public static float volumeOfEllipsoid(float r1,
                                            float r2, 
                                            float r3)
    {
        float pi = (float)3.14;
        return (float) 1.33 * pi * r1 * r2 * r3;
    }
  
    // Driver Code
    public static void Main()
    {
        float r1 = (float)2.3, 
            r2 =(float) 3.4,
            r3 = (float)5.7;
        Console.WriteLine("volume of ellipsoid is : " + 
                        volumeOfEllipsoid(r1, r2, r3));
    }
}
  
// This code is contributed by vt_m 


PHP




<?php
// PHP program to find the
// volume of Ellipsoid.
  
  
// Function to find the volume
function volumeOfEllipsoid( $r1, 
                            $r2, 
                            $r3)
{
    $pi = 3.14;
    return 1.33 * $pi * $r1 * 
                  $r2 * $r3;
}
  
// Driver Code
  
    $r1 = 2.3; $r2 = 3.4; 
    $r3 = 5.7;
    echo ( "volume of ellipsoid is : ");
    echo( volumeOfEllipsoid($r1, $r2, $r3));
      
  
// This code is contributed by vt_m .
?>


Javascript




<script>
// javascript program to find the 
// volume of Ellipsoid.
  
// Function to find the volume
function volumeOfEllipsoid( r1, r2, r3)
{
    let pi = 3.14;
    return 1.33 * pi * r1 *
                  r2 * r3;
}
  
// Driver Code
   let r1 = 2.3, r2 = 3.4, r3 = 5.7;
    document.write( "volume of ellipsoid is : "
         + volumeOfEllipsoid(r1, r2, r3).toFixed(2));
  
// This code contributed by Rajput-Ji 
  
</script>


Output : 
 

Volume of ellipsoid is : 186.15

Time Complexity: O(1) 
Auxiliary Space: O(1)

Please suggest if someone has a better solution which is more efficient in terms of space and time.



Previous Article
Next Article

Similar Reads

Program to calculate Surface Area of Ellipsoid
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 g
4 min read
Program to calculate area and volume of a Tetrahedron
A Tetrahedron is simply a pyramid with a triangular base. It is a solid object with four triangular faces, three on the sides or lateral faces, one on the bottom or the base and four vertices or corners. If the faces are all congruent equilateral triangles, then the tetrahedron is called regular. The area of Tetrahedron can be found by using the fo
5 min read
Program to calculate Volume and Surface area of Hemisphere
Calculate volume and surface area of a hemisphere. Hemisphere : In geometry, it is an exact half of a sphere. We can find many of the real life examples of the hemispheres such as our planet Earth can be divided into two hemisphere the southern & northern hemispheres.   Volume of Hemisphere : Volume of a Hemisphere is nothing but the amount of
4 min read
Program to calculate volume of Octahedron
Given the side of the Octahedron then calculate the volume of Octahedron. Examples: Input : 3 Output : 12.7279 Input : 7 Output : 161.692 Approach: The volume of an octahedron is given by the formula: Volume = √2/3 × a3 where a is the side of Octahedron Below is the implementation to calculate volume of Octahedron: [GFGTABS] CPP // CPP Program to c
2 min read
Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
Given radius and height of Cylinder, calculate the volume, total surface area and curved surface area of cylinder. Volume of Cylinder: The volume of cylinder is defined as the amount of three dimensional space occupied by the cylinder or the storage capacity of a cylinder. We can calculate volume of cylinder by using formula: where ' r 'is radius o
7 min read
Calculate Volume and Surface area Of Sphere
Given radius of sphere, calculate the volume and surface area of sphere.Sphere: Just like a circle, which geometrically is a two-dimensional object, a sphere is defined mathematically as the set of points that are all at the same distance r from a given point, but in three-dimensional space. This distance r is the radius of the sphere, and the give
6 min read
Calculate Volume of Dodecahedron
Given the edge of the dodecahedron calculate its Volume. Volume is the amount of the space which the shapes takes up. A dodecahedron is a 3-dimensional figure made up of 12 faces, or flat sides. All of the faces are pentagons of the same size.The word 'dodecahedron' comes from the Greek words dodeca ('twelve') and hedron ('faces').Formula: Volume =
3 min read
Calculate volume and surface area of Torus
This article is about the surface and mathematical concept of a torus. A 3D shape made by revolving a small circle (radius r) along a line made by a bigger circle (radius R). Property: It can be made by revolving a small circle (radius r) along a line made by a bigger circle (radius R).It is not a polyhedronIt has no vertices or edgesSurface Area T
5 min read
Calculate volume and surface area of a cone
Given slant height, height and radius of a cone, we have to calculate the volume and surface area of the cone.  Cone : Cone is a three dimensional geometric shape. It consists of a base having the shape of a circle and a curved side (the lateral surface) ending up in a tip called the apex or vertex.     Volume of a cone : The volume of a cone is gi
5 min read
Program for volume of Pyramid
A pyramid is a 3-dimensional geometric shape formed by connecting all the corners of a polygon to a central apex. There are many types of pyramids. Most often, they are named after the type of base they have. Let's look at some common types of pyramids below. Volume of a square pyramid [base of Pyramid is square] = (1/3) * (b^2) * h Volume of a tri
7 min read
Program to find the Area and Volume of Icosahedron
Given the side of an Icosahedron. The task is to find the area and volume of the given Icosahedron.Examples : Input : a = 5 Output : Area: 216.506 Volume: 272.712 Input : a = 10 Output : Area: 866.0254 Volume: 2181.695 In geometry, an Icosahedron is a regular polyhedron which contains 20 identical equilateral triangular faces, 30 sides, and 12 vert
5 min read
Program to find the Volume of a Triangular Prism
Given the length, width, and height of a triangular prism, the task is to find the volume of the triangular prism. Examples: Input: l = 18, b = 12, h = 9 Output: Volume of triangular prism: 972 Input: l = 10, b = 8, h = 6 Output: Volume of triangular prism: 240 In mathematics, a triangular prism is a three-dimensional solid shape with two identical
3 min read
Program to find the Volume of an irregular tetrahedron
Given the length of edges of an irregular tetrahedron. The task is to determine the volume of that tetrahedron. Let the Edge length of pyramids be u, U, v, V, w, W. Examples: Input: u = 1000, v = 1000, w = 1000, U = 3, V = 4, W = 5 Output: 1999.9947 Input: u = 2000, v = 2000, w = 2000, U = 3, V = 4, W = 5 Output: 3999.9858 Formula to calculate the
7 min read
Program to find volume and surface area of pentagonal prism
A prism that has 5 rectangular faces and 2 parallel pentagonal bases is a pentagonal prism. So you are given the apothem length(a), base length(b) and height(h) of the pentagonal prism. you have to find the surface area and the volume of the Pentagonal Prism.Examples: Input : a=3, b=5, h=6 Output :surface area=225, volume=225 Input : a=2, b=3, h=5
4 min read
Program to find Surface Area and Volume of Octagonal Prism
Given the base length, height, and distance of Octagonal Prism we have to find the Surface Area and Volume of the octagonal prism for the given parameters. The octagonal prism is a solid three-dimensional object having a total of 10 faces, 24 edges, and 16 vertices. The two faces at either end are octagons and the rest of the faces are rectangular.
5 min read
Program for Volume and Surface Area of Cube
Cube is a 3-dimensional box-like figure represented in the 3-dimensional plane. Cube has 6 squared-shape equal faces. Each face meet another face at 90 degree each. Three sides of cube meet at same vertex. Examples: Input : Side of a cube = 2 Output : Area = 8 Total surface area = 24 Input : Side of a cube = 3 Output : Area = 27 Total surface area
3 min read
Program for Volume and Surface Area of Cuboid
Cuboid is a 3-dimensional box-like figure represented in the 3-dimensional plane.Cuboid has 6 rectangled-shape faces. Each face meet another face at 90 degree each.Three sides of cuboid meet at same vertex.Since it is made up of 6 rectangle faces, it have length, width and height of different dimension. Examples : Input : 2 3 4 Output : Area = 24 T
4 min read
Program for Volume and Surface area of Frustum of Cone
Given slant height, height and radius of a frustum of a cone, we have to calculate the volume and surface area of the frustum of a cone. Frustum of cone In geometry, a frustum is the portion of a solid (normally a cone or pyramid) that lies between one or two parallel planes cutting it. If we cut a right circular cone by a plane parallel to its bas
8 min read
Volume of cube using its space diagonal
Given the length of space diagonal of a cube as d. The task is to calculate the volume occupied by the cube with the given length of space diagonal. Space diagonal is a line connecting two vertices that are not on the same face. Examples: Input: d = 5 Output: Volume of Cube: 24.0563 Input: d = 10 Output: Volume of Cube: 192.45 Volume of cube whose
4 min read
Surface Area and Volume of Hexagonal Prism
Given a Base edge and Height of the Hexagonal prism, the task is to find the Surface Area and the Volume of hexagonal Prism. In mathematics, a hexagonal prism is a three-dimensional solid shape which have 8 faces, 18 edges, and 12 vertices. The two faces at either ends are hexagons, and the rest of the faces of the hexagonal prism are rectangular.
5 min read
Maximum volume of cube for every person when edge of N cubes are given
Given an array of N integers which denotes the edges of N cubical structures respectively. Also given are M integers which denote the number of peoples. The task is to find the maximum amount of volume of a cube that can be given to every person. Note: Cubes can be cut off any shape from any of the N cubes. Examples: Input: a[] = {1, 1, 1, 2, 2}, m
10 min read
Percentage increase in volume of the cube if a side of cube is increased by a given percentage
Given here is a cube, whose one side is increased by a given percentage. The task is to find percentage increase in the volume of the cube.Examples: Input: x = 10 Output: 33.1% Input: x = 50 Output: 237.5% Approach In a cube, all sides are equal, so, length = breadth = heightlet side of the cube = agiven percentage increase = x%so, volume before in
3 min read
Percentage increase in volume of the sphere if radius is increased by a given percentage
Given here is a sphere, whose radius is increased by a given percentage. The task is to find the percentage increase in the volume of the sphere.Examples: Input: x = 10 Output: 33.1% Input: x = 50 Output: 237.5% Approach: Let, the radius of the sphere = agiven percentage increase = x%volume before increase = 4/3*πa^3new radius after increase = a +
3 min read
Percentage increase in the volume of cuboid if length, breadth and height are increased by fixed percentages
Given a cuboid and three integers L, B, and H. If the length of the cuboid is increased by L%, breadth is increased by B% percent, and height is increased by H% percent. The task is to find the percentage increase in the volume of the cuboid.Examples: Input: L = 50, B = 20, H = 10 Output: 98%Input: L = 10, B = 20, H = 30 Output: 71.6% Approach: Sup
4 min read
Python | Percentage increase in hemisphere volume if radius is increased
Given that the radius of a hemisphere is increased by a fixed percentage so, the target is to calculate the percentage increase in the volume of the hemisphere. Examples: Input : 20 Output : 72.8 %Input : 70 Output : 391.3 % Approach: Let, the radius of the hemisphere = [Tex]a [/Tex]Given percentage increase = [Tex]x% [/Tex]Volume before increase =
2 min read
Percentage change in Hemisphere volume if radius is changed
Given that the radius of a hemisphere is changed by a fixed percentage so, the target is to calculate the percentage changed in the volume of the hemisphere. Examples: Input: r = 20% Output: 72.80%Input: r = 70% Output: 391.30 % Approach: Let, the radius of the hemisphere = [Tex]a [/Tex] Given percentage increase = [Tex]x% [/Tex] Volume before incr
5 min read
Minimum volume of cone that can be circumscribed about a sphere of radius R
Given a sphere of radius R, The task is to find out the minimum volume of the cone that can be circumscribed about it. Examples: Input: R = 10 Output: Volume of cone = 8373.33 Explanation: Radius of cone = 14.14 and Height of cone = 40, Volume of cone = [Tex](1/3) * \pi * r^2 * h[/Tex]So, volume = 8373.33Input: R = 4 Output: Volume of cone = 535.89
5 min read
Class 8 RD Sharma Solutions- Chapter 22 Mensuration III (Surface Area And Volume Of Right Circular Cylinder) - Exercise 22.2 | Set 1
Question 1. Find the volume of a cylinder whose (i) r = 3.5 cm, h = 40 cm (ii) r = 2.8 m, h = 15 m Solution: (i) Given that, r = 3.5 cm, h = 40 cm As we know that Volume of a cylinder = πr2h = 22/7 × 3.5 × 3.5 × 40 = 1540 cm3 (ii) Given that, r = 2.8 m, h =15 m As we know that Volume of a cylinder = πr2h = 22/7 × 2.8 × 2.8 × 15 = 369.6 m3 Question
11 min read
Class 9 RD Sharma Solutions - Chapter 19 Surface Area And Volume of a Right Circular Cylinder - Exercise 19.2 | Set 2
Question 17. The height of a right circular cylinder is 10.5 m. Three times the sum of the areas of its two circular faces is twice the area of the curved surface. Find the volume of the cylinder. Solution: Given that Height of the cylinder = 10.5 m According to the question 3(2πr2) = 2(2πrh) 3r = 2h r = 2/3 x h r = 2/3 x 10.5 = 7cm So, the radius
14 min read
Volume and Surface Area - Aptitude Question and Answer
Volume and Surface area topics are very crucial topics for any exam that has Quantitative Aptitude section in their exam pattern. One such National exam is SSC CGL, Every year you can witness at least one question from this topic and as we all know, in any government exam, even a single mark can make a huge difference in ranking or clearing the cut
8 min read