Write a program to find x to the power n (i.e. x^n). Take x and n from the user. You need to print the answer.
Answers
Answered by
1
The program and it's output has been attached above. Kindly check it!
Attachments:
Answered by
3
Answer:
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int n = sc.nextInt();
System.out.println((int)Math.pow(x,n));
}
}
Explanation:
I guess you understand the code...
Similar questions