Write a whole program with three functions one with the area

Write a whole program with three functions, one with the area of a circle, and the others with the surface area and volume of a cylinder, then calling those functions from the main program.

Solution

#include<stdio.h>
#include<conio.h>
#define PI 3.141
float area(float a);
float area(float b,float c);
float volume(float d, float e);
void main()
{
float radius,height;
clrscr();
printf(\"\ Enter Radius\");
scanf(\"%f\",&radius);
printf(\"Enter height for cylinder\ \");
scanf(\"%f\ \",&height);
area(radius);
area(radius,height);
volume(radius,height);
getch();
}
float area(float a)
{
float area;
area=PI*a*a;
printf(\"Area of circle is %f\ \",area);
return(area);
}
float area(float b, float c)
{
float sarea;
sarea=2*PI*b*(b+c);
printf(\"\ Surface area of cylinder is %f\ \",sarea);
return(sarea);
}
float volume(float d, float e)
{
float volume;
volume=PI*d*d*e;
printf(\"\ Volume of Cylinder is %f \",volume);
return(volume);
}

 Write a whole program with three functions, one with the area of a circle, and the others with the surface area and volume of a cylinder, then calling those fu

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site