whats wrong with this atm code ??

#include <stdio.h>
#include <stdlib.h>

int main()
{
   float a[2];
   scanf("%f%f",&a[0],&a[1]);
   int d=(int)a[0];
   float val=a[1]-a[0]-0.5;
   if(d%5==0&&a[0]<a[1]+0.5)
   {
       printf("%.2f",val);
   }
   else
    printf("%.2f",a[1]);
    return 0;
}

In The condition if(d%5==0 && a[0] < a[1]+0.5) ,it should be a[0]+0.5 <= a[1]. You can also write it as val >= 0

Did you mean

if (d % 5 == 0 && a[0] <= a[1] - 0.5)
//