HS08TEST help for this problem

hello my code is given below …

#include
#include
using namespace std;
void atm(int x,double y);
int main(int argc, char const *argv[])
{
int x;
double am;
cin>>x>>am;
if(x%5==0 && x<am)
atm(x,am);
else
cout<<am;
return 0;
}
void atm(int x,double y)
{
y=y-x-0.50;
printf("%0.2f\n",y);
}

my problem is why codechef says this is wrong ans when i try to run it. it gives exact answer

https://www.codechef.com/viewsolution/39801745

here you go… the problem with your code is that you haven’t set the precision at “cout<<am;” and also consider the case when am=5 and x=5 . According to your logic it should pass but actually we need extra 0.5 dollar to make the transition happen so (x%5==0&&x<am-0.5) is the correct way.