ATM !! .. help me

/* package codechef; // don’t place package name! */

import java.util.*;

import java.text.*;

import java.lang.*;

import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */

class Codechef
{

public static void main (String[] args) throws java.lang.Exception

{

 Scanner ans=new Scanner(System.in);
 DecimalFormat np=new DecimalFormat("#.00");
    float n,y;
    n=ans.nextFloat();
    y=ans.nextFloat();
    if(n>0 && n<=2000 && y>=0 && y<=2000)
    {
    if(n<y)
    {
        if(n%5==0)
        {
        
        y=(float)(y-n-0.5);
        }
    }
    }
    System.out.println(np.format(y));
}

}
/*what is the one condition which I missed to take while solving the problem */

if(n<=y)

You arent accounting for bank charges. If n==y, then your y will be negative which is invalid.

1 Like

You are STILL not accounting for bank charges. The correct condition is

if(withdrawil+0.5<=Bank_Balance)