ATM problem

#include<stdio.h>
main()
{
int wit;
float bal;
scanf("%d%f",&wit,&bal);
if((wit>0)&&(bal>=0)&&(wit<=2000)&&(bal<=2000))
{
bal=(wit>bal)?bal:(wit==bal)?bal:(wit%5==0)?(bal-wit-0.50):bal;
printf("%.2f",bal);
}
return 0;
}

please tell me what is wrong in this code?

use this condition (bal-withdrawal-0.50)>0) u will get the answer

@akash_r corrected portion of ur code
{ bal=(wit>bal"-0.5")?bal:(wit==bal)?bal:(wit%5==0)?(bal-wit-0.50):bal; printf("%.2f",bal); }
u can only withdraw if u have enuf balance including the additional amount which is charged while withdrawing…i have marked the corrected portion in quotes :slight_smile: