VOOZH about

URL: https://www.geeksforgeeks.org/dsa/program-area-perimeter-rectangle/

⇱ Program for Area And Perimeter Of Rectangle - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Program for Area And Perimeter Of Rectangle

Last Updated : 16 Feb, 2023

A rectangle is a flat figure in a plane. It has four sides and four equal angles of 90 degree each. In rectangle all four sides are not of equal length like square, sides opposite to each other have equal length. Both diagonals of the rectangle have equal length.

👁 Image

Examples:  

Input : 4 5
Output : Area = 20
 Perimeter = 18

Input : 2 3
Output : Area = 6
 Perimeter = 10

Formulae :  

Area of rectangle : a*b 
Perimeter of rectangle: 2*(a + b) 

Output : 

Area = 30
Perimeter = 22

Time complexity : O(1) 
Auxiliary Space : O(1)


 

Comment