Skip to content

Commit 06c5e64

Browse files
authored
Update PowerOf.java
1 parent 641df67 commit 06c5e64

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

recursiveFunction/PowerOf.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ public static void main(String[] args) {
1818
String c = s.nextLine();
1919

2020
int a;
21-
22-
// if negative exponent
21+
2322
if (c.contains("-")) {
2423
c = c.substring(1);
2524
a = Integer.valueOf(c);
2625
System.out.println(b + " to the power of " + "-" + a + " is " + "1/" + powerOf(b, a));
26+
System.out.println("1/(" + b + superscript(a) + ")");
2727
}
28-
29-
// if positive exponent or zero
28+
3029
else {
3130
a = Integer.valueOf(c);
3231
System.out.println(b + " to the power of " + a + " is " + powerOf(b, a));
32+
System.out.println(b + superscript(a));
3333
}
3434

3535

0 commit comments

Comments
 (0)