C Program to Find Area of a Circle using Preprocessor


In this post, I am going to write a c program to find the area of a circle using the preprocessor. What is the meaning of c preprocessor?

It is also a program that processes our source program before it is passed to the compiler. For this purpose, we can use directives. There are various features of the preprocessor. We are not going into detail. In this post, I am just going to use the concept of macro expansion. We can use this macro for declaring constant.

See the following program.

C Program to Find Area of a Circle using Preprocessor

#define PI 3.14     //Macro
int main()
float r,area;
printf("Enter the radius\n");
printf("Area of Circle is %.2f",area);
return 0;

As you can see in the above program, for calculating the area of a circle, we need the value 3.14. Instead of using this value directly, we have used a macro. In other words, I have declared the constant PI using #define. Here, we can call PI a template.

In this program, we have used this macro only one time. The value of PI is replaced by 3.14.


Enter the radius
Area of Circle is 78.50

I hope you like this program. If you have any doubt or any feedback, please contact me.

Thank you.

Some Important C Programs

  1. Switch Case in C Program to Calculate Area of Circle and Triangle
  2. C Language Program to Count the Number of Lowercase Letters in a Text File
  3. Program in C to Replace Capital C with Capital S in a File
  4. C Program to Remove White Spaces and Comments from a File
  5. Perfect Number in C Programming using All Loops

Leave a Comment