power(a,b) returns a number which is the solution of ab.

Tip: If you need the third or n-th root of a number, you can use the function power(a,(1/n)).

For example:

power(2,3) = 8

power(3,2) = 9

power(10,2) = 100

power(4,3) = 64

power(81,1/4) = 3 (--> The forth root of 81 is 3, because 34 = 81).

Where can you use this function?

For example, if we want to draw a perfect right triangle. In a right triangle, where c is the hypotenuse and a and b are legs, the equation a2 + b2 = c2 always holds. We can use this information to calculate the steps to go when drawing the right triangle.

Code:

power_english_bearbeitet.png