stuck on ATM. Can't figure out what's wrong! Please Help!

#include <stdio.h>

int main(void)
{
   int draw;
    
    float total, remain;
    
    scanf("%d%f", &draw, &total);
    
    if (draw % 5 == 0 && (draw > 0 && draw < total))
    {
        remain = total - (draw + 0.50);
        printf("%0.2f\n", remain);
    }
    
    else
    {
        printf("%0.2f\n", total);
    }
    
    return 0;
}

@dush_ik

Try a case when you have to withdraw amount x and the actual amount in bank is less than (x+0.5) but greater than (x).

What is the result ???

Assume x is divisible by 5…

1 Like

Okk… you didn’t got my point…

To be more precise i was talking about such input,

30 30.25

withdraw amount = x

x > actual amount > (x + processing fees)

Thank you!

Welcome :slight_smile: