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.
Declaring methods
Raise to the power
Report a typo
Sample Input 1:
4 3Sample Output 1:
64Sample Input 2:
5 0Sample Output 2:
1Sample Input 3:
10 10Sample Output 3:
10000000000Write 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));
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.