title: Method output giving wrong output
body: <pre><code>public class Pow {
  
      public double getAnswer(double a, double b) {
  
          double b2 = 0;
  
          if (b &gt; 0) {
              for (int i = 1; i &lt; b; i++) {
                  a = a * a;
              }
              return a;
          } else if (b &lt; 0) {
              int c = 0;
              while (c &gt; b) {
                  a = a * a;
                  c--;
              }
              b2 = 1 / a;
          }
          return b2;
      }
  }
  </code></pre>
  <p>I need the second part of my method to return the value of a negative power(i.e. 5^-2 = .04), but the output is always 0. The first part of the method works fine from what I have tested. I do have the last curly braces but they just wouldn't fit in the text box on here. Any help/suggestions would be much appreciated!</p>