Skip to content

Instantly share code, notes, and snippets.

@peter279k
Created May 24, 2017 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peter279k/46ae57df738c53d2a900978786d80c1b to your computer and use it in GitHub Desktop.
Save peter279k/46ae57df738c53d2a900978786d80c1b to your computer and use it in GitHub Desktop.
TQC+ JAVA
import java.util.*;
public class JPA03 {
public static void main (String argv[]){
int num1, num2;
Scanner input = new Scanner(System.in);
System.out.println("Input:");
num1 = input.nextInt();
while (true) {
if(num1 == 999) {
break;
}
num2 = input.nextInt();
System.out.println(powerOf(num1, num2));
System.out.println("Input:");
num1 = input.nextInt();
}
}
static int powerOf (int m, int n) {
int sum = 1;
for(int index=1;index<=n;index++) {
sum *= m;
}
return sum;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment