We all know how to withdraw money from ATM machine. When my friend was checking his account balance, first time I came to know about ATM machine, I wondered by looking at that machine (It was the Andhra Bank ATM at Kodad). Of course I didn't even know what is a computer at that time.

Have you ever thought about how the ATM machine is dispensing money? It's just a simple calculation happens to decide how the notes have to be withdrawn. That calculation program just looks like below. Of course it is very simple stand alone program and you can extend based on your requirements.

`import java.io.*;/** * This class will print the denomination of notes while withdrawing money from ATM. * @author SANTHOSH REDDY MANDADI * @version 1.0 * @since 20-Sep-2012 */public class Withdraw{  public static void main(String[] args) throws Exception  {    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));    int n=Integer.parseInt(br.readLine());    if(n>15000)    {      System.out.println("ATM Cash Limit exceeds.");    }    else    {      if(n<500)      {        System.out.println(n/100+" Hundreds");      }      else      {        int h=5;        int f=(n-500)/500;        //System.out.println(n-500+" "+(n-500)/500+" "+(n-500)%500);        h += ((n-500)%500)/100;        if(h>5)        {          f=f+1;          h=h-5;        }        System.out.println(f+" Five Hundreds and "+h+" Hundreds");      }    }  }}`
Output
`>java Withdraw10001 Five Hundreds and 5 Hundreds>java Withdraw6001 Five Hundreds and 1 Hundreds>java Withdraw1001 Hundreds>java Withdraw32006 Five Hundreds and 2 Hundreds`

If you've sometime, why don't you have a look at my Other Java programs.