Whats wrong in this code? #ATM #PracticeProblem

,

double a,f,bal;
scanf("%lf",&a);
scanf("%lf",&f);
if((int)a%5==0 && a<=f)
{
bal=f-a-0.5;
}
else
bal=f;
printf("%lf",bal);

In if statement you have to write a<=f-0.5
and also return 0 at the end as it might give you runtime error.

Try executing your code on this test case:

30 30.25

Your code will print:

-0.250000

So you need to check that (withdrawal amount + 0.5 (Transaction fees) ) <= amount in bank.