#include<stdio.h>
int main()
{
int w;
float b;
scanf("%d %f",&w,&b);
if((w%5==0)&&(w<=b))
printf("%\n.2f",(b-w-0.5));
else
printf("%\n.2f",b);
return 0;
}
#include<stdio.h>
int main()
{
int w;
float b;
scanf("%d %f",&w,&b);
if((w%5==0)&&(w<=b))
printf("%\n.2f",(b-w-0.5));
else
printf("%\n.2f",b);
return 0;
}
test your program, its showing wrong ans for every testcase
check your print statement
Check the printf() statement. That is wrong way to print out a float with 2 decimal points.
Change that to…
printf("%.2f\n",...);
When w=0 and b=120.00 then expected answer is 120.00 but your answer is 119.50. and when w=120 and b=120.00 then expected answer is 120.00 because account balance isn’t negative but your answer is -0.50.
So, please correct your code and any help then check this link -
http://www.codechef.com/viewsolution/4122388
.
friend, you have made many mistakes
changed it but still wrong answer
“The cash machine will only accept the transaction if X is a multiple of 5, and Pooja’s account balance has enough cash to perform the withdrawal transaction (including bank charges).” Now check when w == b or (b - w) < 0.50 .