Respuesta :
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
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".
The volume program is a sequential program and does not require loops and conditional statements.
The volume program in Python, where comments are used to explain each line is as follows
#This initializes pi to 3.142
pi= 3.142
#This gets input for radius
sphere_radius = float(input("Radius: "))
#This calculates the sphere volume
sphere_volume = (4.0 / 3.0) * sphere_radius**3
#This prints the sphere volume
print(sphere_volume)
Read more about sequential programs at:
https://brainly.com/question/17970226