Problem title
Difficulty
Avg time to solve

Longest Sub-string With K Distinct Characters
Easy
15 mins
Longest Subarray Zero Sum
Easy
15 mins
Majority Element - II
Easy
10 mins
Valid String
Moderate
18 mins
Longest Palindromic Substring
Easy
20 mins
Find K’th Character of Decrypted String
Moderate
33 mins
Reach the destination
Easy
15 mins
Topological Sort
Moderate
30 mins
Find power of a number
Easy
15 mins
Longest Common Subsequence
Moderate
39 mins
25

Find power of a number

Difficulty: EASY
Contributed By
Avg. time to solve
15 min
Success Rate
80%

Problem Statement

Ninja is sitting in an examination hall. He is encountered with a problem statement, "Find ‘X’ to the power ‘N’ (i.e. ‘X’ ^ ‘N’). Where ‘X’ and ‘N’ are two integers."

Ninja was not prepared for this question at all, as this question was unexpected in the exam.

He is asking for your help to solve this problem. Help Ninja to find the answer to the problem.

Note :

For this question, you can assume that 0 raised to the power of 0 is 1.

Input format :

The first line of input contains integer ‘T’ denoting the number of test cases. Then each test case follows:

The first and only line of each test case contains two integers ‘X’ and ‘N’ (separated by space).

Output Format :

Output will contain a single integer which will be equal to X ^ N (i.e. X raise to the power N).

Output of each test cases will be printed on separate line.

Note:

You do not need to print anything, it has already been taken care of. Just implement the given function.

Constraints:

1 <= T <= 5
0 <= X <= 10
0 <= N <= 10

Time Limit: 1 sec.
Sample Input 1:
2
5 2
9 3
Sample Output 1:
25
729
Explanation for Sample Input 1:
Test Case 1: 
Given X = 5 and N = 2. So, 5 ^ 2 = 25. As 5 * 5 = 25.

Test Case 2:
Given X = 9 and N = 3. So, 9 ^ 3 = 729. As 9 * 9 * 9 = 729.
Sample Input 2:
2
5 0
1 10
Sample Output 2:
1
1
Reset Code
Full screen
copy-code
Console