Find Power – First Digit & Last Digit

The program must accept an integer as the input. The program must print the value of the first digit raised to the power of the last digit in N as the output.

Boundary Condition(s):
10 <= N <= 10^18

Input Format:
The first line contains N.

Output Format:
The first line contains the value of the first digit raised to the power of the last digit in N.

Example Input/Output 1:
Input:
652

Output:
36

Explanation:
Here N = 652.
The first digit in 652 is 6.
The last digit in 652 is 2.
So the value of raised to the power of is 36.
Hence the output is 36

Example Input/Output 2:
Input:
95902112273

Output:
729

n=list(input().strip())
f=int(n[0])
l=int(n[-1])
print(f**l)

Leave a Reply

Your email address will not be published. Required fields are marked *

More posts. You may also be interested in.