DevJourney · code I wrote while learning

Rectangle Dimensions

2 items

README.md

Single File Programming Question

Problem Statement

Riya is designing a room layout for her new apartment. She needs to calculate the area of various rooms, which are rectangular. To simplify her work, she decides to create a Rectangle class with the following features:

Private attributes length and breadth to store the dimensions of the rectangle. A constructor to initialize these attributes. A friend function void calcArea(Rectangle s) to calculate and display the area of the rectangle.

Help Riya by writing a program that takes the length and breadth of a rectangle as input, calculates its area using the calcArea function, and displays the result.

Input format :

The input consists of the length and breadth.

Output format :

The output prints the area of the rectangle.

Refer to the sample output for formatting specifications.

Code constraints :

The given test cases fall under the following constraints:

1 ≤ Length, Breadth ≤ 100

Sample test cases :

Input 1 :

10 12

Output 1 :

120

Input 2 :

15 20

Output 2 :

300