ATM problem c++

I have submitted by code so many times but codechef still says my answer is wrong, I cannot seem to find whats wrong, if someone could point this out it would really help me.

#include
#include
using namespace std;

int main()
{

int amount_withdrawn;
float total_amount;


cin >> amount_withdrawn >> total_amount;

if(amount_withdrawn > 0 && amount_withdrawn <= 2000 && total_amount >= 0 && total_amount <= 2000)
{
    if(amount_withdrawn % 5 == 0 && (amount_withdrawn + 0.05) <= total_amount)
	{
        cout << total_amount - amount_withdrawn - 0.05;
    }

    else
        cout << fixed<<setprecision(2)<<  total_amount;
}   
return 0;

}

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Edit:

While we’re waiting - why are you using 0.05 when the problem statement says “0.05$US”?

Why are only one of your cout statements using 2 dp of precision?

1 Like

Thankyousomuch, i figured out the problem . I was using 0.05$ instead of 0.50$ :woman_facepalming:t2:

1 Like