Rectangle Measurements - I
You are given two positive double-precision floating-point numbers, length and breadth, representing the dimensions of a rectangle. Calculate its area and perimeter.
Use:
- Area = length × breadth
- Perimeter = 2 × (length + breadth)
Input
- The input contains two space-separated double-precision floating-point numbers length and breadth. Both values may contain decimal digits.
Output
Print the area followed by the perimeter, separated by a single space. Print both values with exactly six digits after the decimal point, without labels or trailing spaces.
Example 1:
Input:
5 3
Output:
15.000000 16.000000
Explanation:
The area is 5 × 3 = 15, and the perimeter is 2 × (5 + 3) = 16.
Example 2:
Input:
2.5 4
Output:
10.000000 13.000000
Explanation:
The area is 2.5 × 4 = 10, and the perimeter is 2 × (2.5 + 4) = 13.
Now Your Turn!
Pick the correct output for the given inputInput:
1.5 2
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 0 < length, breadth <= 10000
- Each dimension contains at most six digits after the decimal point.