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.
Back to basics 11 - Max Integer
Find the dimensions of a matrix
Area of a Square
Back to Basics - Find no. of elements in a matrix?
Maximum value in a matrix
Finding fourier transform of a given vector
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