bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / practice-c / pc-ip-08.c

pc-ip-08.c (653B)


      1 /*
      2  * Question 8:
      3  * Write a program that takes the radius of a circle as input, passes it to a function that computes area and circumference, and displays results in main().
      4  */
      5 
      6 #include <stdio.h>
      7 #include <math.h>
      8 
      9 void area_circumference(double, double *, double *);
     10 
     11 int main()
     12 {
     13     double r, area, cir;
     14     printf("Enter the radius of the circle: ");
     15     scanf("%lf", &r);
     16     area_circumference(r, &area, &cir);
     17     printf("\nArea of the circle: %g", area);
     18     printf("\nCircumference of the circle: %g", cir);
     19     return 0;
     20 }
     21 
     22 void area_circumference(double r, double *area, double *cir)
     23 {
     24     *area = M_PI * r * r;
     25     *cir = 2 * M_PI * r;
     26 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror