Tax slab please help
This link to my program of tax slab output is correct every single value but online judge is showing wrong answer please tell me why?..

It will fail this test case

Your code’s output will be 925001
Correct answer is 925000

And if you want AC
Change this line from your code : s=s+(n-1500000)*3/10;
and modify it to : s=s+(n-1500000)*0.3;

And you are ready to go
here’s a solution and an idea to minimise the number of brackets as it makes it harder to debug and much difficult to find where it went wrong :slight_smile:

There’s where i got confused , The Brackets

1 Like

Try taking input as double. If you keep your answer in long or integer datatype for sum, while computing ( e.g. s=s+(n-1000000)*0.2 ), you will definitely incur some loss in some cases.