JavaScript Problem-2

Questions: Write an HTML document to find X to power n where value of x and n taken from user?

Ans. The solution of above question is as follows:

var x=prompt("Enter value of X: ","");
var n=prompt("Enter value of n: ","");
var result=Math.pow(x,n);
document.write(result);

Happy Coding!

Leave a Reply