Created
May 24, 2017 11:02
-
-
Save peter279k/46ae57df738c53d2a900978786d80c1b to your computer and use it in GitHub Desktop.
TQC+ JAVA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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