+ 2

can anyone tell how to fix this code?

it does shows up the correct output. the first and second if else statement is correct, but the last one (supposed to be deducted by 9%) is wrong and is always deducting it by 6% https://code.sololearn.com/cTT1WZB3vtxW/?ref=app

30th Sep 2020, 1:00 PM
Egg
5 ответов
+ 2
The first and third if statements are in fact, doing fine. In the second if statement, on line 28 if(number == 8001-15000) are you sure you want to compare number to 8001-15000, which is -6999. If you want to see if number lies between 8001 and 15000, this would be the better approach if (number > 8000 && number < 15001) Also, just a side note, in all the 3 if statements, you are not actually displaying the salary after deducting 4%, 6% or 9%, you are displaying 4%, 6% and 9% of the salary instead. Maybe that's what you want to do, just pointing out.
30th Sep 2020, 1:18 PM
XXX
XXX - avatar
+ 1
Egg please fix the code and then write the input you tried and the output it gave here so I can try it myself.
30th Sep 2020, 2:00 PM
XXX
XXX - avatar
0
XXX thanks for answering! but it still doesn't show the correct output though
30th Sep 2020, 1:32 PM
Egg
0
XXX I've figured it out, i replaced && with || and it shows the proper output already.
30th Sep 2020, 11:49 PM
Egg
0
XXX btw THANK YOU so much for the help!
30th Sep 2020, 11:49 PM
Egg