80
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
- Define Values for the side of the rectangle
- Apply values in the formula.
- 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#