Can anyone helps me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone helps me?

https://code.sololearn.com/cgLI1t61H2z0/?ref=app There are four options(25, 10, 5, 1) to subtract the integer until 0. 98 supposed will have 8 coins(25*3 + 10*2 + 1*3) at last but it turns out only 6 coins. Why? Can anyone helps me out.

10th May 2020, 3:19 AM
chengzheng wong
chengzheng wong - avatar
2 Answers
+ 2
You are using OR when you actually need AND, to check if both conditions are fulfilled before moving on the the next if statement. Change all || to &&.
10th May 2020, 3:28 AM
Hatsy Rei
Hatsy Rei - avatar
- 1
hey thank you i've been stucking here for so many hours. Finally :)
10th May 2020, 3:40 AM
chengzheng wong
chengzheng wong - avatar