Created
December 24, 2013 15:44
-
-
Save NusZzz/8114925 to your computer and use it in GitHub Desktop.
The example of factorial by using Recursive algorithm.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Factory { | |
public static void main(String[] args) { | |
int x = Fac(5); | |
System.out.print(x); | |
} | |
public static int Fac(int n){ | |
if(n==1){ | |
return n; | |
}else{ | |
return n*Fac(n-1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment