We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- Prepare
- Functional Programming
- Introduction
- Compute the Perimeter of a Polygon

# Compute the Perimeter of a Polygon

# Compute the Perimeter of a Polygon

You are given the cartesian coordinates of a set of points in a plane. When traversed sequentially, these points form a Polygon, , which is not self-intersecting in nature. Can you compute the perimeter of polygon ?

**Input Format**

The first line contains an integer, , denoting the number of points.

The subsequent lines each contain space-separated integers denoting the respective and coordinates of a point.

**Constraints**

- No points are
*coincident*, and polygon is obtained by traversing the points in a clockwise direction.

**Output Format**

For each test case, print the perimeter of (correct to a scale of one decimal place).

**Note:** Do not add any leading/trailing spaces or units.

**Sample Input**

```
4
0 0
0 1
1 1
1 0
```

**Sample Output**

```
4
```

**Explanation**

The given polygon is a square, and each of its sides are unit in length. , so we print on a new line.