Answer:
Following are the program in C++ language
#include <iostream>// header file
using namespace std; // namespace
int main() // main method
{
float sphere_radius,sphere_volume ; // variable declaration
float pi=3.14; // variable initialization
cout<<" Enter the radius:";
cin>>sphere_radius; // Read the value by user
sphere_volume=(4.0 / 3.0) * pi* sphere_radius*sphere_radius*sphere_radius; // calculated the volume
cout<<"The volume is:"<<sphere_volume; // display volume
return 0;
}
Output:
Enter the radius:
1.00
The volume is: 4.18667
Step-by-step explanation:
Following are the description of program
- Declared a variable sphere_radius,sphere_volume as "float" type .
- Declared a variable pi and initialized with "3.14".
- Read the value of radius by user in the "sphere_radius".
- Now calculated the volume by using given formula .
- Finally print the "sphere_volume".