Skip to content

Instantly share code, notes, and snippets.

@sutirthaC97
Created April 9, 2017 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sutirthaC97/fd5f7a9664987c3f11764a1254128a16 to your computer and use it in GitHub Desktop.
Save sutirthaC97/fd5f7a9664987c3f11764a1254128a16 to your computer and use it in GitHub Desktop.
An example of a C program where preprocessor directive #define and the mathematical function pow are employed.
/*C program to print area of a circle whose radius is given as input*/
#include <stdio.h>
#include <math.h>//for the function -> pow()
#define pi 3.141
int main(){
double radius, area;
printf("\nEnter the value of the radius: ");
scanf("%lf",&radius);
area = pi*pow(radius, 2);
printf("\nThe area of the circle is : %lf", area);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment