#include<stdio.h>
int main()
{
int x ;
float y;
scanf("%d",&x) ;
scanf("%f",&y);
if( (x>0 && x<=2000) && (y>=0 && y<=2000))
if(x%5==0 && y>x) y= (y-x )-0.50;
printf("%.2f" , y);
return 0 ;
}
#include<stdio.h>
int main()
{
int x ;
float y;
scanf("%d",&x) ;
scanf("%f",&y);
if( (x>0 && x<=2000) && (y>=0 && y<=2000))
if(x%5==0 && y>x) y= (y-x )-0.50;
printf("%.2f" , y);
return 0 ;
}
@aryan_raj18 : If y = 5.05 and x = 5 , you will allow transaction to happen and give negative result .
You need to check x%5==0 && y>=x+0.5