Wrong answer in ATM prob

,

I am unable to understand the problem with this code and why it gets WA.


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    int x;
    float y;
    cin>>x>>y;
    if(x>(y+0.50))
    {
        cout<<fixed<<setprecision(2)<<y;
    }
    else
    {
        if(x%5==0)
    {
        cout<<fixed<<setprecision(2)<<y-x-0.50;
    }
        else
    {
        cout<<fixed<<setprecision(2)<<y;
    }

    }

}


The condition x>(y+0.50) should be x+0.5 > y!

1 Like

Ah ok! I didn’t get the concept right at first! Thanks a lot kcahdog!