Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Complete the following program which calculates and displays the area and perime

ID: 3874481 • Letter: C

Question

Complete the following program which calculates and displays the area and perimeter of a circle Hint: area of circle = circumference of circle = 2r /*Program to find the circumference and area of a circle #include-stdio.h> #define PI 3.142 void main float circum, area; float radius; void circumarea(float, float *, float*); printf"nEnter the radius of a circle in metres:In"); //read radius from the keyboard /call circumarea in main() printf("nCircumference of the circle is %f metres", circum); printf(" Area of the circle is %fsq.metres", area); void circumarea (float r, float *ci, float *ar)

Explanation / Answer

Given below is the code for the question.
Please don't forget to rate the answer if it was helpful. Thank you


#include <stdio.h>
#define PI 3.142
void main()
{
float circum, area;
float radius;
  
void circumarea(float, float *, float *);
  
printf(" Enter the radius of a circle in meters: ");
scanf("%f", &radius); //read radius from keyboard
  
circumarea(radius, &circum, &area); //call circumarea from main()
  
printf(" Circumference of the circle is %f meters", circum);
printf(" Area of the circle is %f sq.meters ", area);
}

void circumarea(float r, float *ci, float *ar)
{
*ci = 2 * PI * r;
*ar = PI * r * r;
}


output
======
Enter the radius of a circle in meters:
5

Circumference of the circle is 31.420000 meters
Area of the circle is 78.550003 sq.meters

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote