I have the following program
Code:
#include <math.h>
#include <stdio.h>
#define PI 3.14159
/* Function prototypes */
void instruct(void);
/*
* Displays instructions to a user of program to compute the
* area and circumference of the open-top cylindrical
* container.
*/
void
instruct(void)
{
printf("This program determines the cost of producing an\n");
printf("open-top cylindrical container.\n\n");
printf("To use this program, we first must determine the\n");
printf("radius of the base of the open-top cylindrical container\n\n");
printf("So please enter the radius of the base after the prompt:\n");
}
int main(void)
{
instruct();
return(0);
}
After the instructions I would like to have the following function to compute the surface area of a cylinder. My teacher is instructing me to have to call the function from MAIN. How do I do this?
Code:
#include <math.h>
#include <stdio.h>
#define PI 3.14159
int main(void)
{
double radius;
double height;
double surface_area;
double base;
double length;
printf("Enter radius > ");
scanf("%lf", &radius);
printf("Enter the height > ");
scanf("%lf", &height);
base = (PI * pow(radius, 2));
length = (2.0 * PI * radius) * height;
surface_area = base + length;
printf("The surface area is %5.2f.\n",
surface_area);
return(0);
}