Hope y'all having a great day... Why is the tax amount showing zero and how can it be corrected... Thanks | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hope y'all having a great day... Why is the tax amount showing zero and how can it be corrected... Thanks

https://code.sololearn.com/cDFHY5nT16XZ/?ref=app

7th Jan 2021, 1:24 PM
Precious Okechukwu
Precious Okechukwu - avatar
2 Answers
+ 2
On line 9 taxAmount = sales * (10 / 100); The division is happening between 2 integers (10/100), which leads to conversion of answer (0.1) to type integer only (0), making the overall result equal to 0 Simple fix is to convert any one of them to floating point number 👇 https://code.sololearn.com/cuB3Gxf4Sehv/?ref=app
7th Jan 2021, 1:29 PM
Arsenic
Arsenic - avatar
+ 1
Wow... thanks 😀👍
7th Jan 2021, 1:33 PM
Precious Okechukwu
Precious Okechukwu - avatar