C++ program to find the area of a circle

C++ program to find the area of a circle

In this C++ program tutorial our task is to:

  • Write a C++ program to find the area of the circle

C++ program to calculate the area of a circle

Given below is the C++ code where we take radius of the circle as an input  and the area of the circle is given as the output.

#define pi 3.14       //macros where the value of pi is defined
using namespace std;
int main()
    float radius,areaOfCircle;
    cout<<"Enter the value of the radius"<<endl;
    areaOfCircle = pi * radius * radius;      //Calculating the area of the circle
    cout<<"Area of the circle\n"<<areaOfCircle<<endl;
    return 0;


Enter the value of the radius


Area of the circle



A macros is defined in the above program (#define pi 3.14). Macros are defined so that the program run faster and is very efficient while doing competitive programming.


  • In the above program the compiler first compiling from the main function (here int main()).
  • Then two 4(assuming 32/64-bit system) bits memory space are created for the two float variable .
  • Then it takes in the input for the radius and goes to the calculation part.
  • It then searches for the value of "pi" which has been defined as a macros.
  • After that the value get saved in the areaOfCircle


You can see the above code execution and output in codeblocks IDE:

C++ program to find the area of the circle


CPP Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by

About the Author
Sayantan Bose
- šŸ”­ Iā€™m currently working on DS Algo skills - šŸŒ± Iā€™m currently learning web develeopement - šŸ‘Æ Iā€™m looking to collaborate with Oppia - šŸ“« Reach me at - šŸ˜„ Pronouns: his/him
Page Views :    Published Date : Jul 24,2020  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!