Given two integers r and d where r is the radius of the smaller circle and d is the difference of the area of this circle with some larger radius circle. The task is to find the area of the larger circle. Examples:
Input: r = 4, d = 5 Output: 55.24 Area of the smaller circle = 3.14 * 4 * 4 = 50.24 55.24 – 50.24 = 5 Input: r = 12, d = 3 Output: 455.16
Approach: Let radius of the smaller and the larger circles be r and R respectively and the difference in the areas is given to be d i.e. PI * R2 – PI * r2 = d where PI = 3.14 Or, R2 = (d / PI) + r2. Now, area of the bigger circle can be calculated as PI * R2. Below is the implementation of the above approach:
Please Login to comment...