Area of Circle – CTS PATTERN

Area of Circle: You are required to fix all logical errors in the given code. You can click on run anytime to check the compilation/execution status of the program. You can use printf to debug your code. The submitted code should be logically/syntactically correct and pass all test cases. Do not write the main() function as it is not required. 

Code Approach: For this question, you will need to correct the given implementation. We do not expect you to modify the approach or incorporate any additional library methods. 

The function double areaOfCircle(double R) accepts a floating point value R (which is the radius of the circle) as the input. The function returns the area of the circle.

The function compiles fine but fails to return the desired results for some test cases. 

Your task is to fix the program so that it passes all test cases.

double areaOfCircle(double R)
{
    return 22*R*R/7;
}
Previous Article

Maximum Uncommon Characters

Next Article

Function middle - CTS PATTERN

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *