M power N Using Recursive function
This is one of the example of using recursive function in Java to find M power N
public class MPowerN {
public static int pow(int m, int n){
return (n>1) ? m*pow(m, n-1) : m;
}
}
@Test
public void test() {
assertEquals(pow(2,3), 8);
}