Given two integers x and n, compute X^n.
Please solve this code in python.
Answers
Answered by
6
Answer:
hello,
Explanation:
n=int(input("enter the number"))
x=int(input("enter the number"))
result=x**n
print(result,"is the required answer")
hope it helps you
please mark brainliest
@ItzSnowySecret07
Answered by
0
def power(x, y):
if (y == 0): return 1
elif (int(y % 2) == 0):
return (power(x, int(y / 2)) *
power(x, int(y / 2)))
else:
return (x * power(x, int(y / 2)) *
power(x, int(y / 2)))
# Driver Code
x = 2; y = 3
print(power(x, y))
Output is "8"
In python
Or in another way might be useful for you
x=int(input("Enter a number"))
n=int(input("Enter a power"))
z=(x**n)
print (z)
Similar questions