Area Calculator

You need to design a function named area that can calculate area based on the number of parameters passed:

  • If 1 parameter (r) is passed → calculate and returns an integer which represents area of a circle
  • If 2 parameters (l, b) are passed → calculate and returns an integer which represents area of a rectangle

Formulas:

  • Circle → Ï€ × r × r (Use Ï€ = 3.14)
  • Rectangle → l × b

Example 1:

Input: r = 2, l = 3, b = 5

Output: Circle = 12

Rectangle = 15

Explanation:

Area of circle = 3.14 * 2 * 2 = 12.56 = 12

Area of rectangle = 3 * 5 = 15

Example 2:

Input: r = 1, l = 2, b = 2

Output: Circle = 3

Rectangle = 4

Now Your Turn!

Pick the correct output for the given input

Input: r = 4, l = 0, b = 100

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 0 <= r, l, b <= 100

Hints

0
//your code goes here
Test Case

Input:

B
L
R