title: Withdraw money from ATM
body: <p>I need to print out something like these.</p>
  
  <pre class="lang-none prettyprint-override"><code>If the input is 60, then the output should be "Here is 3 $20 notes and 0 $50 notes."
  If the input is 100, then the output should be "Here is 0 $20 notes and 2 $50 notes."
  If the input is 120, then the output should be "Here is 1 $20 notes and 2 $50 notes."
  </code></pre>
  
  <p>Code:</p>
  
  <pre class="lang-java prettyprint-override"><code>import java.util.Scanner;
  
  class Main {
      public static void main(String[] args) {
          Scanner input = new Scanner(System.in);
          int i, j, n = input.nextInt();
          int x = 0, y = 0;
  
          if (n % 50 == 0) {
              j = n/50;
              for (i = 1; i != j+1; i++) {
                  y++;
              }
              System.out.println("Here is " + x + " $20 notes and " + y + " $50 notes.");
          }   
          else if (n % 20 == 0 &amp;&amp; n &lt; 100) {
              j = n/20;
              for (i = 1; i != j+1; i++) {
                  x++;
              }
              System.out.println("Here is " + x + " $20 notes and " + y + " $50 notes.");
          }
          else if ((n % 100 != 0) &amp;&amp; (n &gt; 100) &amp;&amp; (n % 20 == 0)) {
              y = n/100;
              int l = n-(y*100);
              if (l % 20 == 0) {
                  int k = l/20;
                  for (i = 1; i != k+1; i++) {
                      x++;
                  }
                  System.out.println("Here is " + x + " $20 notes and " + y*2 + " $50 notes.");
              }
          }
          else if ((n % 50 != 0) &amp;&amp; (n &gt; 50)) {
              y = n/50;
              int l = n-(y*50);
              if (l % 20 == 0){
                  int k = l/20;
                  for (i = 1; i != k+1; i++) {
                      x++;
                  }
                  System.out.println("Here is " + x + " $20 notes and " + y + " $50 notes.");
              }
          }
          else {
              System.out.println("Sorry, the value you input cannot be withdrew.");
          }
      }
  }
  </code></pre>
  
  <p>This is what I did so far. It does not work with input of 110, 130, 210, etc.</p>