**New course!**Every coder should learn

**Generative AI!**

+ 1

# Why is the result always 0?

Can someone tell what I did wrong? I did try a =20 and b = 10, the result should be 47, 1.. ButI get always zero:( https://sololearn.com/compiler-playground/csH0Ot48654D/?ref=app

5 Answers

+ 2

You should use floating-point numbers rather than integers.
this: ' float Area = pi * ((b * b) / 4.0) * ((2.0 * a - b) / (2.0 * a + b));' ?

+ 1

Check your user define function, it is the area of an ellipse, right?
This is the correct user define function will be for the area of an Ellipse:
float Area = pi * a * b / 4 * (2.0 - ((a - b) * (a - b)) / ((a * a) + (b * b)));

+ 1

No it is to calculate the circel area inscribed in an isosceles triangel

+ 1

Very attentive and clever! Thank you!

+ 1

You're welcome 🙂