C++ Program to Find Volume of Sphere.

A Sphere is a geometrical three-dimensional ball-like structure with no face. It is basically a set of points that are present at an equal distance from a given point in three-dimensional space and this equal distance r is known as the radius of the Sphere. 


In this post, we are going to learn how to calculate the volume of a sphere and how to implement the same in C++ programming.

The volume of any object is basically the amount of space that the object takes in three-dimensional space. The simple formula to calculate the volume of a sphere is shown below.

Find Volume of Sphere

C++ Example Code:

//C++ Code Implementation for Volume of Sphere
#include<iostream>
using namespace std;

int main(){
    int r;
    float volume;

    cout<<"Calculate the volume of the Sphere."<<endl;
    cout<<"Enter the radius of Sphere: ";
    cin>>r;

    volume = (4/3) * 3.14 * r * r * r;
    cout<<"The Volume of Sphere: "<<volume<<endl;

    return 0;
}
Output:
Calculate the volume of the Sphere.
Enter the radius of Sphere: 4.5
The volume of Sphere: 200.96 

Next:

⚡ Please share your valuable feedback and suggestion in the comment section below or you can send us an email on our offical email id ✉ algolesson@gmail.com. You can also support our work by buying a cup of coffee ☕ for us.

Similar Posts

No comments:

Post a Comment


CLOSE ADS
CLOSE ADS