bsc

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

pc-ip-08.c (789B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 05 Jan 2026
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /*
      8  * Question 8:
      9  * 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().
     10  */
     11 
     12 #include <stdio.h>
     13 #include <math.h>
     14 
     15 void area_circumference(double, double *, double *);
     16 
     17 int main()
     18 {
     19     double r, area, cir;
     20     printf("Enter the radius of the circle: ");
     21     scanf("%lf", &r);
     22     area_circumference(r, &area, &cir);
     23     printf("\nArea of the circle: %g", area);
     24     printf("\nCircumference of the circle: %g", cir);
     25     return 0;
     26 }
     27 
     28 void area_circumference(double r, double *area, double *cir)
     29 {
     30     *area = M_PI * r * r;
     31     *cir = 2 * M_PI * r;
     32 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror