Program to calculate the volume of the sphere

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

  1. Define the radius of the sphere
  2. Define the pie and assign (22/7)
  3. Calculate the volume of the sphere as (4/3)*pie*r3
  4. Assign the volume of the sphere to volume_of_sphere
  5. Print the volume of the sphere.

Complexity

O(1)


Solution

C Program

Output:

Volume of the sphere=463433.132812 

PHP Program

Output:

Volume of the Sphere=463433.14285756  

Java Program

Output:

Volume of the sphere=463433.14285756415

C# Program

Output:

Volume of sphere=463433.142857564

Python Program

Output:

volume of the sphere=463433.14285756415   

Next Topic#




Latest Courses