C Program to calculate area of Circle, if Radius is given | Area of Circle program in C language

Spread the love

Description: 

This program accepts one value(float value) from user and stores it into radius parameter. Then it will calculate the Area of Circle based on that radius.

Formula for Area of Circle:

Here is the formula to calculate the area of Circle.

        Area = π × r2

The area of a circle is π (Pi) times the Radius squared. Where  π (Pi) is 22/7 or 3.142. 

Program :

  1.  #include <stdio.h>
  2. #include <math.h>
  3. #define PI 3.142
  4.  
  5. void main()
  6. {
  7.     float radius, area;
  8.     printf(“Enter the radius of a circle );
  9.     scanf(“%f”, &radius);
  10.     area = PI * pow(radius, 2);
  11.     printf(“Area of a circle = %5.2fn, area);
  12. }

Output :

Related Programs:

Venkat

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply