Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabh-agarwal committed Sep 23, 2017
1 parent 9f0aa1e commit cb27ddf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Recursion/src/RecursionGOODLUCK.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@ public static int Factorial(int n) {
return n * Factorial(n-1);
}
}

public static int exponentiation(int n, int p) {
if(p <= 0) {
return 1;
}
else {
return n * exponentiation(n, p-1);
}
}

public static void main(String[] args) {
System.out.println("Summation "+Summation(10));
System.out.println("Factorial "+Factorial(10));
System.out.println("Exponentiation "+ exponentiation(10,2));
}
}

0 comments on commit cb27ddf

Please sign in to comment.