• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
September 05, 2022 |3.5K Views
C++ program to find the area and perimeter of rectangle
Description
Discussion

In this video, we will write a C++ Program to Find Area & Perimeter of Rectangle.

Formulae to find the Area and Perimeter of the Rectangle are as follows:
=> Area of rectangle =  l * b
=> The perimeter of rectangle =  2 *( l+b)

Approach:
Step 1: Initialize four variables : a, b, area and perimeter.
Step 2: Take input of a and b from the user.
Step 3: Apply the formula to calculate the area and perimeter of rectangles and store them in their respective variables.
Step 4: Output the value of an area and perimeter variables.

For Examples:
=> Input 3 4
      Output Area = 12
      Perimeter = 14

=> Input 3 7
      Output Area = 21
      Perimeter = 20

Here, we calculate the Area & Perimeter of the Rectangle using simple math formula. 

Program for Area And Perimeter Of Rectangle: https://www.geeksforgeeks.org/program-area-perimeter-rectangle/

Read More