Interview Solution

If builders built buildings the way programmers wrote programs, then the first woodpecker that came along wound destroy civilization. Gerald Weinberg

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.