Skip to content
Home » C program to find Area of a Circle Using Symbolic Constant

C program to find Area of a Circle Using Symbolic Constant

Learn about C program to find Area of a Circle Using Symbolic Constant in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

C program to find Area of a Circle Using Symbolic Constant

A semicolon is not used at the conclusion of a #define line. PI=3.14 is the value of ℼ is obtained from the defined line. We used % .2f, which prints as a floating point with two characters after the decimal points. The below program prints the area of the circle given the radius.

Source code:

#include<stdio.h>
#define PI 3.14
int main()
{

     float radius, area;

     // inputs from user
     printf("Enter Radius of Circle(in cm): ");
     scanf("%f",&radius);

     // calculating area
     area = PI * radius * radius;

     // print result
     printf("Area of Circle = %.2f cm\n",area);

     return 0;
 }

Output:

Enter Radius of Circle(in cm): 7
Area of Circle = 153.86 cm

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Find Area of a Circle Triangle and Rectangle
C program to find the distance between two given points