Raise to the power

Report a typo

You're given the method power that takes two int numbers n and m. The method should return the value of nm as a long value.

Write a body of the method.

Sample Input 1:

4 3

Sample Output 1:

64

Sample Input 2:

5 0

Sample Output 2:

1

Sample Input 3:

10 10

Sample Output 3:

10000000000
Write a program in Java 17
import java.util.Scanner;

public class Main {

public static long power(int n, int m) {
// write your code here
}

/* Do not change code below */
public static void main(String[] args) {
final Scanner scanner = new Scanner(System.in);
final int n = scanner.nextInt();
final int m = scanner.nextInt();
System.out.println(power(n, m));
}
}
___

Create a free account to access the full topic