#include <stdio.h>
int main (void) {
int x = 0;
float y = 0.0;
scanf("%d%f",&x, &y);
if (!( (x > 0) && (x<=2000) && (y>=0) && (y<=2000) ) )
;
else{
if (x%5!=0 || x+.50>y)
printf("%.2f\n", y);
else
printf("%.2f\n", y-x-.50);
}
return 0;
}
For the following input: 14.50 15.00 the answer is supposed to come as 15. However it is coming as 0.50 which is apparently wrong coz as x is an integer program reads 14.5 as 14 and the condition 'x%5!=0' happens to be true. Hence it should execute the first print but it is executing the second print. Can anyone tell me why?