﻿ C# Sharp exercises: Calculate the perimeter and area of a circle - w3resource

C# Sharp Exercises: Calculate the perimeter and area of a circle

C# Sharp Basic Data Types: Exercise-5 with Solution

Write a C# Sharp program that takes the radius of a circle as input and calculate the perimeter and area of the circle.

JavaScript: Area and circumference of a circle

In geometry, the area enclosed by a circle of radius r is πr2. Here the Greek letter π represents a constant, approximately equal to 3.14159, which is equal to the ratio of the circumference of any circle to its diameter.

The circumference of a circle is the linear distance around its edge.

Why is the area of a circle of a circle pi times the square of the radius?

Sample Solution:-

C# Sharp Code:

``````using System;
public class Exercise5
{
public static void Main()
{

double r,per_cir;
double PI = 3.14;
Console.WriteLine("Input the radius of the circle : ");
per_cir = 2 * PI * r;
Console.WriteLine("Perimeter of Circle : {0}", per_cir);
}
}
```
```

Sample Output:

```Input the radius of the circle :
25

Perimeter of Circle : 157
```

Flowchart:

C# Sharp Code Editor: