image2text

Untitled

Aug 8th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. 1%
  2. * Recursive method for raising x to the power n.
  3. “gpren >0
  4. “ Gpre for n =0, x 1= 0
  5. * Gparan x The nusber being raised to 3 power.
  6.  
  7. “ Gparan n The exponent.
  8. “ Greturn x raised to the power n.
  9. */
  10. public static double power(double x, int n) {
  11. if (<o)
  12. return 1/ (x * power(x, -n));
  13. } else if (n == 0) {
  14. return 1;
  15. ¥ etse 4l
  16. return x * pover(x, n - 1);
  17. 3
Advertisement
Add Comment
Please, Sign In to add comment