Created
April 9, 2017 15:16
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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