Wrong Answer

Please check the question at http://www.codechef.com/problems/HS08TEST?page=2 and my solution at


Its giving wrong answer,don’t know why?

Is not there any way to check what wrong output it gives or what the output of the code?

In your code,

int x;
float y,z;

Aren’t you taking input in the opposite manner? The first input is a +ve(x in your case) integer and second is a float number(y). As your code says, x is the amount you need to withdraw and y is the total money in the account. That’s why you have done x+0.5<=y!

Thus, you are taking reverse input and this is the mistake in your code. Here is your AC


  [1]: http://www.codechef.com/viewsolution/5781496

Bro your code give output 30.0000 instead of 89.50.so you can say there is something wrong with the algorithm.you can use any ide or or online compilers to check output. ideone.com is good.and one more thing your output in this problem must have exact 2 decimal places…89.5 wont work so if you are using C so use %.2f instead of %f.