Codechef ATM Problem

What is the problem in this code codechef is showing wrong answer in ATM Problem.

#include
#include
using namespace std;

int main()
{
int withdrawlAmount;
float accountBalance;

cin>>withdrawlAmount>>accountBalance;

float currentBalance = accountBalance;


if(withdrawlAmount%5 == 0 && withdrawlAmount + 0.5f<accountBalance)
{
    currentBalance = accountBalance - withdrawlAmount - 0.5f;
    
}

cout<<setprecision(2)<<fixed<<currentBalance<<"\n";


return 0;

}

1 Like

You’re allowed to leave zero money, so the < should be <= when checking the balance.

1 Like