Answer:
class Main {
static void printPowers(int howMany, int nrRows) {
int n=1;
while(n<=nrRows) {
int power = 1;
while(power <= howMany) {
System.out.printf("%d ", (int) Math.pow(n,power));
power++;
}
System.out.println();
n++;
}
}
public static void main(String[] args) {
printPowers(3,5);
}
}
Step-by-step explanation:
Created a method with two parameters.