fueanta

Recursive Power Method

Jun 3rd, 2017
121
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public static int power(int m, int n)
  2.     {
  3.         if (n == 0) {
  4.             return 1;
  5.         }
  6.         else if (n == 1) {
  7.             return m;
  8.         }
  9.        
  10.         return m *= power(m, n - 1);
  11.     }
RAW Paste Data