Program to calculate volume of Ellipsoid
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.
Below is code for calculating volume of ellipsoid :
C++
// CPP program to find the // volume of Ellipsoid. #include <bits/stdc++.h> using namespace std; // Function to find the volume float volumeOfEllipsoid( float r1, float r2, float r3) { float pi = 3.14; return 1.33 * pi * r1 * r2 * r3; } // Driver Code int main() { float r1 = 2.3, r2 = 3.4, r3 = 5.7; cout << "volume of ellipsoid is : " << volumeOfEllipsoid(r1, r2, r3); return 0; } |
Java
// Java program to find the // volume of Ellipsoid. import java.util.*; import java.lang.*; 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(String args[]) { float r1 = ( float ) 2.3 , r2 = ( float ) 3.4 , r3 = ( float ) 5.7 ; System.out.println( "volume of ellipsoid is : " + volumeOfEllipsoid(r1, r2, r3)); } } // This code is contributed by Sagar Shukla |
Python
''' Python3 program to Volume of ellipsoid''' import math # Function To calculate Volume def volumeOfEllipsoid(r1, r2, r3): return 1.33 * math.pi * r1 * r2 * r3 # Driver Code r1 = float ( 2.3 ) r2 = float ( 3.4 ) r3 = float ( 5.7 ) print ( "Volume of ellipsoid is : " , volumeOfEllipsoid(r1, r2, r3) ) |
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 . ?> |
Output :
Volume of ellipsoid is : 186.15
Recommended Posts:
- Program to calculate volume of Octahedron
- Program to calculate area and volume of a Tetrahedron
- Program to calculate Volume and Surface area of Hemisphere
- Calculate Volume of Dodecahedron
- Calculate Volume and Surface area Of Sphere
- Calculate volume and surface area of Torus
- Calculate volume and surface area of a cone
- Calculate Volume, Curved Surface Area and Total Surface Area Of Cylinder
- Program for volume of Pyramid
- Program for Volume and Surface Area of Cuboid
- Program to find the Volume of an irregular tetrahedron
- Program for Volume and Surface Area of Cube
- Program to find the Area and Volume of Icosahedron
- Program to find the Volume of a Triangular Prism
- Java Program for Program to calculate area of a Tetrahedron
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : vt_m