


For this question, you can assume that 0 raised to the power of 0 is 1.
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 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.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 5
0 <= X <= 10
0 <= N <= 10
Time Limit: 1 sec.
The approach is to recursively call the recursive function for X and N - 1 and multiplying the value returned by the recursive function with X.
As X ^ N is same as X * (X ^ (N - 1)).
In this approach, we will call the recursive function for ‘X’ and ‘N / 2’. As X ^ N is same as
( X ^ (N / 2) ) * ( X ^ (N / 2) ) for N being an even number and X * ( X ^ (N / 2) ) * ( X ^ (N / 2) ) for N being an odd number.
Bob’s Robot
Transpose of a Matrix
Number of Digits
Fizzbuzz Problem
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series
Print Fibonacci Series