A manufacturer wishes to determine the cost of producing an open-top cylindrical
ID: 638945 • Letter: A
Question
A manufacturer wishes to determine the cost of producing an open-top cylindrical container. The surface area of the container is the sum of the area of the circular base plus the area of the outside as follows:
=+
Write a C program that asks the user to enter the radius of the base, the height of the container, the cost per square centimeter of materials and the number of containers to be produced. Calculate and display the surface area of one container, the cost of one container and the total cost of producing all the containers. Properly format your output, showing units for all output values, and appropriate number of decimal places.
Explanation / Answer
#include <stdio.h>
#include <math.h>
int main()
{
float radius, height;
float surface_area, volume;
printf("Enter value for radius and height of a cylinder : ");
scanf("%f%f", &radius, &height);
surface_area = 2 * (22 / 7) * radius * (radius + height);
volume = (22 / 7) * radius * radius * height;
printf("Surface area of cylinder is: %.3f", surface_area);
printf(" Volume of cylinder is : %.3f", volume);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.