C Exercises: Calculates the volume of a sphere
2. Volume of a Sphere Calculation
Write a C program that calculates the volume of a sphere.
C Programming : Volume of a sphere
A sphere is a perfectly round geometrical object in three-dimensional space that is the surface of a completely round ball.
In three dimensions, the volume inside a sphere is derived to be V = 4/3*π*r3 where r is the radius of the sphere

Sample Solution:
C Code:
Sample Output:
Input the radius of the sphere : 2.56 The volume of sphere is 70.276237.
Flowchart:

For more Practice: Solve these Related Problems:
- Write a C program to calculate the volume of a sphere using the power function and compare it with a hardcoded approximation of Pi.
- Write a C program to compute the volume of a sphere given its diameter and handle floating-point precision issues.
- Write a C program to calculate the volume of a sphere and then determine the difference in volume between two spheres with consecutive radii.
- Write a C program to calculate the volume of a sphere and validate the input radius to ensure it is positive.
C Programming Code Editor:
Previous: Write a C program that convert a temperature from Centigrade to Fahrenheit.
Next: Write a C program that prints the perimeter of a rectangle to take its height and width as input.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.