 # PHP Program to find the Area and Circumference of the circle

October 21, 2023, Learn eTutorial
1844

## How to find the Area and Circumference of the Circle, given radius

The area of a circle means the total area which is enclosed by the circle shape. The circumference or perimeter of a circle is the total length of the curve of the circle.

To find the area of a circle first, we have to know the radius of the circle and use the formula

`Area = pi r2 `

• where 'r' is the radius of the circle
• pi is a constant and its value is 3.14

To find the circumference or perimeter of a circle, we use the formula

`Circumference = 2 pi r.`

• r is the radius of the circle
• pi is a constant whose value is 3.14

For example, if the radius of the circle is 7 then the area of the circle will be `π * 72 `which will be 153.938. The circumference or the perimeter will be `2 * π * 7 `which will be 43.982.

## How to find the area and circumference using PHP

In this PHP program, we are using the built-in functions

• `pi()` for the pi(3.14)
• `pwo()` to find the power of the value
• `round() `to limit the number of digits after the decimal point.

First, we have to read the radius from the user and assign it to a variable, and to find the area we have to use the formula

`Area = pi() * pow(radius, 2) `

To find the circumference or perimeter we have to use the formula

`circumference or Perimeter = 2 * pi() * radius`

### ALGORITHM

STEP 1: Accept the radius from the user and assign it to a variable radius

STEP 2: Calculate the area using formula  'pi() * pow(radius, 2)' and assign it to the variable area

STEP 3: Calculate the circumference using formula  '2 * pi() * radius' and add that value to variable circumference

STEP 4: Print the values of the variable 'area' and 'circumference' as the area and circumference of the circle

## PHP Source Code

```                                          ```<?php
```Enter the radius: 15