Skip to content

Commit

Permalink
Merge pull request ambujraj#1343 from naorinn/patch-1
Browse files Browse the repository at this point in the history
Create factorial4.java
  • Loading branch information
ambujraj authored Nov 15, 2018
2 parents 3d248f3 + 47010c6 commit 64e9733
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions factorial/factorial4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public class Factorial {
public static void main(String[] args) {
System.out.println(factorial(4));
}
public static int factorial(int n) {
if (n == 0) {
return 1;
} else {
return n * factorial(n - 1);
}
}
}

0 comments on commit 64e9733

Please sign in to comment.