HS08TEST ATM getting wrong answer!!

Why i am getting wrong answer here??
#include <stdio.h>
int main()
{
int n;
float i;
scanf("%d %f",&n,&i);
if(n <= (i-0.25))
{
if (n%5==0)
{
printf("%0.2f",i=i-n-0.5);
}
else
{
printf("%0.2f",i);
}
}
else
{
printf("%0.2f",i);
}
return 0;
}
please help me! I am getting wrong answer for all my codes even though they work exactly correct on my system.

Please post link of question and solution.
Don’t post solution like that

1 Like

I have just changed the if condition,
instead of (i-0.25) it should be i-0.5 because the 0.5 is the bank charges.

#include <stdio.h>
int main()
{
    int n;
    float i;
    scanf("%d %f",&n,&i);
    if(n<=(i-0.5))
    {
        if (n%5==0)
        {
            printf("%0.2f",i=i-n-0.5);
        }
        else
        {
            printf("%0.2f",i);
        }
    }
    else
    {
        printf("%0.2f",i);
    }

    return 0;
}

This code will give you AC.