title: Multiplying Integer to a Certain Power Using Loops
body: <p>I am trying to create a program that takes an integer base and integer exponent and multiply that integer to the certain power entered. But this code doesn't work. What am I doing wrong?</p>
  
  <pre class="lang-java prettyprint-override"><code>import java.io.*;
  
  import java.util.Scanner; 
  
  import java.text.*;
  
  public class Unit3_Lesson4_17 {
  
      static Scanner in = new Scanner(System.in); 
  
      public static void main() {
  
          Scanner scanner = new Scanner(System.in);   
  
          DecimalFormat mf = new DecimalFormat("'$'###,###,###.00");    
          DecimalFormat df = new DecimalFormat("#.###"); 
  
  
          int i, exp, base, answer;  
  
          String start;
  
          System.out.println("Hit Enter to Begin");
          start = scanner.nextLine();
  
          System.out.println("Enter the number");
          base = in.nextInt(); 
  
          System.out.println("Enter the exponent"); 
          exp = in.nextInt();
  
          answer = base;
  
          for (i=1; i&lt;=exp; i++) {
              answer = answer * base;
          }
  
          System.out.println("The answer is " + answer);
          System.out.println("This program is over!"); 
      }
  }
  </code></pre>