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.

Complexity

O(1)


Solution

Python

Output:

Perimeter of Rectangle is:  12

C

Output:

Perimeter of Rectangle is: 18.00000

JAVA

Output:

Perimeter of Rectangle is: 18.0

C#

Output:

Perimeter of Rectangle is: 18

PHP

Output:

Perimeter of Rectangle is: 22

Next Topic#




Latest Courses