Hello Fatima Abdullah HCT 2021,
I interpreted circumference y as arclength and computed the length of the chord subtending the angle. I get 0.841 for the first test. Please check the angle in your code. As it is written, it is not dimensionless.
Just use the chord length formula using trigonometry and then the rounding command. That's it!
I added extra test suite. You can check them.
I have to agree with ChrisR. None of the answers are correct. The first two answers are using the diameter as if it were the radius when calculating the angle. I don't know what the third one has done.
I will give you a hint! go ahead and google Chord Length Using Trigonometry. You will easily answer the question!
Fatima, your solution takes the angle (i.e., half of the angle of the chord) as y/2. If the arclength is y and the radius is x/2, then the full angle is y/(x/2), and half of the angle is y/x.
By "circumference", do you mean the angle measured in radians?
Yes in radians.
@Fatima, mention it in the problem statement as it is quite ambiguous
HI Fatima, I think the correct term is "central angle" instead of circumference.
Is the Point in a Circle?
Whether the input is vector?
Volume of a Parallelepiped
sum of non-primes
Flow rate in a pipe
Area of the yellow shaded region
Total price with tax calculation for (m) items and price (p)
Squares inside a square!
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