IP-08.c (686B)
1 /* Write a program that takes the radius of a circle as input, passes it to a function that 2 computes area and circumference, and displays results in main(). */ 3 4 #include <stdio.h> 5 #include <math.h> 6 7 void area_circumference(double, double *, double *); 8 9 int main() 10 { 11 double r, area, circumference; 12 printf("Enter the radius of the circle: "); 13 scanf("%lf", &r); 14 area_circumference(r, &area, &circumference); 15 printf("\nArea of the circle = %g", area); 16 printf("\nCircumference of the circle = %g", circumference); 17 return 0; 18 } 19 20 void area_circumference(double r, double *area, double *circumference) 21 { 22 *area = M_PI * r * r; 23 *circumference = 2 * M_PI * r; 24 }