HS08TEST:Getting Wrong Answer

inspite getting satisfactory output my submission is denied by as Wrong answer…somebody help what is that iam not getting.

#include<stdio.h>
int main()

{
int x;float y;

scanf("%d %f",&x,&y);

if(x>0 && y>0)

{

if((x%5)==0 && y>x)

	printf("%.2f\n",y-x-0.50);

	else

		printf("%.2f\n",y);
}
return 0;
}

Hi,

Your code needs to consider the withdrawal charges as well
Consider the test case:
5 5.01
Your code will evaluate to successful transaction when infact it should evaluate to false since there is insufficient balance considering the withdrawal charges.
:slight_smile:
Hope you can fix the code now.

1 Like
  1. Read carefully the problem statement, 0<= Y <= 2000, you don’t need to add the first test " if(x>0 && y>0) ";

  2. Your solution isn’t correct for every pair (x,y) such that y-x < 0.5, you have to modify this condition " y>x ".

1 Like

Thanks saurabh…Got it!