ATM Wrong Answer

this is my code. plese tell me what is wrong with this because it is showing the desired output but the codechef says its a wrong answer???

#include <iostream>

using namespace std;

int main()
{
int x;
double a,y,z=0.50;
cin>>x>>y;

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

if(x%5==0)
{
    if(x<y)
        {
            a=((y-z)-x);
            cout<<a;
        }else
            {
            cout<<y;
            }
}else
    {
    cout<<y;
    }
}

This is your corrected code…!!!

the error was…

this:-

 if(x<y)

should be this:-

 if((x+0.5)<=y)

so that after subtracting 0.5 the balance should not become negative…hope it helps…:slight_smile:

//