# Program to find the perimeter of the rectangle

Program to find the perimeter of the rectangle on fibonacci, factorial, prime, armstrong, swap, reverse, search, sort, stack, queue, array, linkedlist, tree, graph etc.

## Program to find the perimeter of the rectangle

### Explanation

A rectangle has four sides in which sides opposite to each other are equal. The perimeter of the rectangle is the area around its outside.

Suppose a, b, c, d are the four sides of rectangle.

a=c and b=d

Perimeter Of Rectangle= a+ b+ c+ d= a+ b+ a+ b= 2(a + b).

### Algorithm

1. Define Values for the side of the rectangle
2. Apply values in the formula.
3. Print the Perimeter.

O(1)

### Python

```a=c=2 # in rectangle sides opposite to each other are equal in length
b=d=4 # length of opposite sides
Perimeter = 2*(a+ b)
print("Perimeter of rectangle is: ");
print(Perimeter);
```

Output:

```Perimeter of Rectangle is:  12
```

### C

```#include<stdio.h>
int main()
{ float a , b, c, d ,perimeter;
a= c= 5;
b=d= 4;
perimeter = 2*(a+b);
printf("\n\n Perimeter of Rectangle is : %f",perimeter);
return (0);
}
```

Output:

```Perimeter of Rectangle is: 18.00000
```

### JAVA

```public class Main
{
public static void main (String args[])
{      float a ,b, c, d, perimeter;
a=c= 5;
b=d=4;
perimeter  = 2*(a+b);
System.out.println("Perimeter of Rectangle is: "+perimeter);
}}
```

Output:

```Perimeter of Rectangle is: 18.0
```

### C#

```using System;
class main
{   static void Main()
{
float  a , b, c, d, perimeter;
a=c=3;
b=d=6;

perimeter =2*(a+b);
Console.WriteLine("Perimeter of Rectangle is: "+perimeter);
}}
```

Output:

```Perimeter of Rectangle is: 18
```

### PHP

```<?php
\$a = \$c=5 ;
\$b = \$d=6 ;
\$Perimeter = 2*(\$a + \$b);
echo("Perimeter of Rectangle is: ");
echo(\$Perimeter);
?>
```

Output:

```Perimeter of Rectangle is: 22
```

Next Topic#