diff --git a/src/MathRelated/PowerOfSquares.java b/src/MathRelated/PowerOfSquares.java index 2ead395..af5e765 100644 --- a/src/MathRelated/PowerOfSquares.java +++ b/src/MathRelated/PowerOfSquares.java @@ -10,12 +10,14 @@ public class PowerOfSquares else { - int count = 0; - while (count <= power) + int count = 1; + int result = base; + while (count < power) { - base = base * base; + result = result * base; + count++; } - return base; + return result; } /* else //unlucky this is not required scammed { diff --git a/src/coffee/Coffee.java b/src/coffee/Coffee.java index 1b42780..58775fd 100644 --- a/src/coffee/Coffee.java +++ b/src/coffee/Coffee.java @@ -45,4 +45,4 @@ public class Coffee extends Batch { return "Name: " + name + "\nPrice: " + price + "\nStock: "+ stock; } -} \ No newline at end of file +}