atm problem

can anyone tell me what is wrong with this code?

#include<stdio.h>
int main()
{
int mon;
float amt,final;
//printf("\n enter the amount to be withdrawn");
scanf("%d",&mon);
//printf("\n enter the amount in the account")
scanf("%f",&amt);
if(mon%5!=0||mon>amt||mon>2000||amt>2000.00||mon<0||amt<0.00)
printf("\n%.2f",amt);

else
{
final=amt-mon-0.50;
printf("\n%0.2f",final);
}
return 0;
}

if(((bal-withdrawal-0.50)>0)&&((int)withdrawal%5==0)) use ths condition

You have to check that if the withdrawn amount + 0.5 be greater than or equal to the total balance. For example you test case will fail if both the mon and amt are the same because mon+0.5 cannot be withdrawn from amount which will be lesser than the previous total. Hope you got the mistake :slight_smile: