Problem Statement
In this challenge, you must find the area of a rectangle defined by length and breadth.
For the given rectangle, if l
is the length, and b
is the breadth, then the formula for area is
area = l * b
Input
The first line of input consists of an integer l
, representing the length of the rectangle, where l>=0
.
The second line of input consists of an integer b
, representing the breadth of the rectangle, where b>=0
.
Output
Print the area of given triangle.
As is
The boilerplate code is already there to read the inputs from user, in the main()
function, and to print the value returned by the areaOfRectangle()
function. Do not edit this code.
To do ✍
has two parameters:
()areaOfRectangle
length
and breadth
. Complete the function that computes the area of given rectangle, and return the result.
Example 1
Test input
5
4
Test output
20
Explanation
area = 5 * 4
= 20
Example 2
Test input
3
15
Test output
45
Python Program
# Complete the following function
def areaOfRectangle(length, breadth):
# Boilerplate code - Do not edit the following
def main():
length = int(input())
breadth = int(input())
print(areaOfRectangle(length, breadth))
if __name__ == "__main__":
main()
Input and Outputs 1
5
4
20
Input and Outputs 2
0
4
0
Input and Outputs 3
7
2
14
# Complete the following function
def areaOfRectangle(length, breadth):
area = length * breadth
return area
# Boilerplate code - Do not edit the following
def main():
length = int(input())
breadth = int(input())
print(areaOfRectangle(length, breadth))
if __name__ == "__main__":
main()