Power function(Contest)
Power function easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Power function easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
Implement pow(X, N), which calculates x raised to the power N i.e. (X^N). Try using a recursive approach Input The first line contains T, denoting the number of test cases. Each test case contains a single line containing X, and N.
Constraints: 1 ≤ T ≤ 100 -10.00 ≤ X ≤10.00 -10 ≤ N ≤ 10 Output For each test case, you need to print the value of X^N. Print up to two places of decimal.
Note: Please take care that the output can be very large but it will not exceed double the data type value. Example Input: 1 2.00 -2
Output: 0.25
Explanation: 2^(-2) = 1/2^2 = 1/4 = 0.25
link: