I need help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need help

Why the second output is 0 here ?! I can't found where's the problem https://code.sololearn.com/cjcY6HW268Hb/?ref=app

5th Jul 2020, 2:15 AM
Morena
Morena - avatar
1 Answer
+ 3
float volume (int r ) { return 3.0 / 4 * 3.14 * r * r * r ; } Explanation: Previously it was 3 / 4 * 3.14 * r * r " r; Where 3 is an integer, divided by 4 (which is also an integer) becomes 0. Multiplied by anything will still be zero.
5th Jul 2020, 2:51 AM
Ipang