Interview Solution

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Martin Golding

Power

Language Java | Level Intermediate | Category Interview Problems | July 24, 2015 4:52 pm

Comments


Interview Problem

Power involves two numbers with a base a and the exponent n. Example 3 pow 4 = 3 x 3 x 3 x 3 = 81.
When n is a positive integer, exponentiation corresponds to repeated multiplication of the base. The languages have a built-in function to calculate the power.
Example:-
Power of 3 ^ 2 = (3 * 3) = 9.0


Output

   					 
Power of 3^2: 9.0

				    

Comments



Please login to add comments.