Please use the set precision method to set upto 2 decimal places and the main problem is the third case where the amount being withdrawn is greater than the balance. In that case check both the conditions simultaneously because 300 being multiple of 5 the first loop is being executed and is giving a negative answer. Do refer this code CodeChef: Practical coding for everyone

plz check on this input 300 120.00
for this you haven’t check the condition and simply you have done par_balance=total_money-amount_withdrawn;
which will result in 120-300 which is a negetive value and again you have done balance=par_balance-0.5 which will again result in a negetive value
and you have displayed balance

so you need to check first that amount_withdrawn and the charge (0.5) is small enough to be taken out from the total_money