Assignment:
//Calculate the Area of a circle and the area of a rectangle
# include
int main ()
{
int length, width,areaR,radius ;
double areaC;
printf("\n enter the length and width of the rectangle:\n");
scanf("%d %d",&length,&width);
printf("\n enter the radius of the circle:\n");
scanf("%d",&radius);
areaR=length*width;
areaC=radius*radius*3.14159;
printf("\n The area of the rectangle is:%d",areaR);
printf("\n The area of the circle is:%.3f",areaC);
return 0;
Q: Break up the program given above (areas) into one main function and 3 user-defined functions:
// gets an integer from the user and returns it
// make 3 calls to this function:
// get the length of the rectangle from the user and return it to main
// get the width of the rectangle from the user and return it to main
// get the radius of the circle from the user and return it to main
int GetNum(void);
// takes two arguments, the length and width of the rectangle and returns the area of the rectangle(areaR)
int Calculate areaR (int length, int width);
// takes one argument, the radius of the circle and returns the area of the circle (areaC)
double Calculate areaC (int radius);