Why it doesn't divide the number so I shall get discount? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
- 1

Why it doesn't divide the number so I shall get discount?

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

31st Jan 2021, 5:49 PM
TeaserCode
2 Réponses
+ 1
double discount = minIndex1/100; is an int division that's why it equals 0. add a decimal to the division, there are many ways to get a double division, here's one: double discount = minIndex1/100.0;
31st Jan 2021, 6:27 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 1
I understand thanks a lot.
31st Jan 2021, 7:20 PM
TeaserCode