Why the output is always 0? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
23rd Dec 2020, 7:03 AM
ABHISHEK
ABHISHEK - avatar
2 Answers
+ 5
Everytime the division is happening between Integers(on line 14,15,19,20 and 23) as both the operands are integers so answer is also casted to integer means 10/100 will be 0 and not 0.1 Simple fix is to convert either numerator or denominator to float so that system implicitly casts the result to float Here is the fix👇 https://code.sololearn.com/cRL9323n8USQ/?ref=app
23rd Dec 2020, 7:13 AM
Arsenic
Arsenic - avatar
+ 1
Thank you 🙏🙏 very much Arsenic
23rd Dec 2020, 7:27 AM
ABHISHEK
ABHISHEK - avatar