are you sure?? O_o
Radius or diameter ?
Test suite does not correspond to question.
yes... I also think test suite is wrong...
I think the test suite is definitely basing it on the radius as the input and not the diameter
The problem means "radius" although it says diameter.
Diameter = 2 * radius
The test suite is misleading, instead of 'diameter', it is supposed to be 'radius'. The area can be calculated this way easily, too: A=(d^2)*pi/4, but it would be another task.
Area of a circle is pi*r^2 where r is the radius
not the diameter so the question is wrong, or the test bench is wrong
The input they give is radius not diameter, don't be fooled, it took me a bit to realize that since the problem states the input is diameter.
bad test. to get the test answer you must square the diameter and multiply it by pi, intead of pi*r^2(or pi*d/2^2)
For this problem, you have taken x as diameter, but answer is correct when you take x as radius. So, please improve your correct answer code.
i think, the question should be updated.It should be written radius instead of diameter....
the area of a circle is defined by:
A = (pi)*(r^2)
--> for d = 2 like in your test suite that means:
r = d/2 --> r=1
--> r^2 = 1
--> multplied by pi = 1*pi
so A(d=2) = A(d/2) = A(r) = r^2 * pi = 1^2 * pi = 1 * pi = pi
not 4*pi like your solution suggests.
Your solution would be correct for R=2 - not D=2 - you should correct this. Ether you change the description that the diameter is given (should be radius to be correct) or you change the Test suite inm order to give correct results.
The test suite is incorrect. It is either the surface area of a sphere given the diameter or the area of a circle given a radius.
Please correct the problem. According to the test case it's the radius that is given, not the diameter...
This user (ALBERT ALEXANDER STONIER) appears to have gamed the system, with fraudulent "likes" of this unremarkable solution submitted by 'sock-puppet' accounts. —DIV
I think , test suite is wrong according to the question statement.
Did you mean "the area of a sphere?"
More test cases need to be added.
Back to basics 14 - Keywords
Replicate elements in vectors
Min of a Matrix
Sum of odd numbers in a matrix
Finding perimeter of a rectangle
Maximum value in a matrix
Finding fourier transform of a given vector
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office