Question: Complete an integer and float variables and iostream function practice that will calculate the area of a circle and the volume of the sphere.
Complete an integer and float variables and iostream function practice that will calculate the area of a circle and the volume of the sphere. The radius is collected keyword. The program should have: . Comment to each line of the program . Declare variables and constant Pl as 3.14159 Prompt a message asking the user to enter a radius from the keywork. Store the value in a variable as an integer. Use assignment operator to update the radius value from the previous step to, radius2, and calculate the area of the circle using the area formula: area = Pl* radius Store the calculated area in a float variable. . Use the radius value again and calculate the volume of sphere using the volume formula: Volume = (4/3)*PI*radius . Store the calculated volume of a sphere in a float variable. Prompt the result and calculation as: The area of the circle is The volume of a sphere is
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
