Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions java/src/factorial.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Created by Shelly Bekhor on 06-01-20.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please describe what this class does

*/
public class factorial {
static int factorial(int n){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please write javadoc

if (n<0){
return -1;
}
else if(n==0){
return 1;
}
else{
return factorial(n-1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have a mistake here. You probably meant n * factorial(n-1)

}
}
}