title: How to calculate exponent with loop?
body: <p>I am currently working on a program that calculates the power of certain numbers. The number limit is 1 to 9. My code is posted below. I have the following issues:</p>
  
  <ol>
  <li><p>Every time I run the program it doesn't print the correct answer. </p></li>
  <li><p>I want to modify the code so the application calculates X to power of Y, where X and Y are allowed to be integers in the range 1 to 9 (including 9). If the user enters an invalid value the program should ask the user for input again. When a user is done with entering the values for base and exponents, the program will print the result.</p></li>
  </ol>
  
  <p>Conditions of this task is that I must use loops to calculate the result by doing 
  several multiplications; I am not allowed to use any available method or API 
  that calculates the result for me. Please help me come up with the solution. </p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package exponent;
  //import java.util.Scanner;
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  
  public static void main(String[] args) throws Exception {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int b,e;
  
      System.out.println("Enter the base");
      b = Integer.parseInt(br.readLine());
      System.out.println("Enter the power");
      e = Integer.parseInt(br.readLine());
      int t = 1;
      for(int i = 1;i &lt;= e; i++);
      {
          t=t*b;
      }
      System.out.println(t);
  
      }
      // TODO code application logic here
  }
  </code></pre>