Find the area of a circle in C programming.

CServer Side ProgrammingProgramming

A circle is a closed figure. All the points of the circle are equidistant from a point that lies inside in circle. The point at the center is known as the center of the circle. The distance of points from the center is known as the radius.

The area is the quantitative representation of the span of the dimensions of a closed figure.

The area of circle is the area enclosed inside the dimensions of a circle.

The formula for calculating the area of a circle,

Area = π*r*r

To calculate the area we are given the radius of the circle as input and we will use the formula to calculate the area,

Algorithm

STEP 1: Take radius as input from the user using std input.
STEP 2: Calculate the area of circle using,
   area = (3.14)*r*r
STEP 3: Print the area to the screen using the std output.

Example

Variables used −

int r , the radius of the circle

float area, the area of circle calculated using the formula.

 Live Demo

#include <stdio.h>
int main(){
   int r = 8;
   float area = (3.14)*r*r;
   printf("The area of the circle is %f",area);
   return 0;
}

Output

The area of the circle is 200.96
raja
Updated on 19-Sep-2019 08:53:05

Advertisements