Develop a structured C program to calculate the surface area and volume of spher
ID: 3654120 • Letter: D
Question
Develop a structured C program to calculate the surface area and volume of sphere. Your program must be structured as follows: main program and two functions: one function for the surface area and the other for the volume. The surface of the sphere = 4 pi r2, The. volume of the sphere = 4 pi r3/3, r being the radius of the sphere. Main program inputs the side of a cube, calls the functions and outputs results if the radius 5; but the main program does not call functions and prints on screen an error message "The input radius is less than 5!" if the radiusExplanation / Answer
#include const double PI=3.14159265; double sphere_area(double r){ return 4*PI*(r*r); } double sphere_volume(double r){ return 4*PI*((r*r*r)/3); } int main(){ double diameter; double radius; double volume, area; printf("Enter the side of a cube: "); scanf("%lf",&diameter); radius=diameter/2.0; if(radiusRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.