A sphere is a perfectly round geometrical object in 3-dimensional space. It is the set of all the points located a particular distance away from a particular point called center. It is perfectly symmetrical and has no edges or vertices.
Formula
Volume= (4/3)*pie*r3
Algorithm
- Define the radius of the sphere
- Define the pie and assign (22/7)
- Calculate the volume of the sphere as (4/3)*pie*r3
- Assign the volume of the sphere to volume_of_sphere
- Print the volume of the sphere.
Complexity
O(1)
Input:
Output:
Volume = (4.0/3.0) * pie * (radius * radius * radius);
= (4.0/3.0) * 3.14 * 48 * 48 * 48
= 463433.132812
C Program
Output:
PHP Program
Output:
Java Program
Output:
C# Program
Output:
Python Program
Output: