![]() |
VOOZH | about |
Given the dimensions of a rectangle (length and breadth), write a program to determine whether the given rectangle is a square or not.
Examples:
Input: Length = 5, Breadth = 5
Output: Square
Explanation: Since the length and breadth of the rectangle is same, therefore the given rectangle is a square.Input: Length = 6, Breadth = 8
Output: Rectangle
Explanation: Since the length and breadth are different, therefore it is a rectangle.
Approach: To solve the problem, follow the below idea:
If the length and breadth of a rectangle are equal, it is a square. Otherwise, it is a rectangle.
Below is the implementation of the algorithm:
Square
Time Complexity: O(1)
Auxiliary Space: O(1)