Interview Solution

Good programmers use their brains, but good guidelines save us having to think out every case. Francis Glassborow

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.