New Learner need answer to understand how codechef work

Hi!
I submitted the code written in c++ after ensuring that it is producing right output in my local machine. After that i pasted it on submission and submitted the code. But after running on codechef it is showing my solution wrong :frowning:
I am newbie need to know how codechef works

question’s link

my submission code

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

int main()
{

int amt;
double bal=0.00, avab; 

cin>>amt>>avab;
if(amt%5==0){
if(amt<avab)
{
    bal = avab - (amt+0.50);
    cout<< fixed << setprecision(2) <<bal;
}

else
{
    cout<< fixed<< setprecision(2)<< avab;

}
}
else
{
     cout<< fixed<< setprecision(2)<< avab;
}


return 0;
}

Try changing this line to

if(amt<=int(avab-0.50))

If amt= 10, avab = 10.25 then the person can’t withdraw as he can’t pay the bank transaction charges of $0.50.

1 Like