Last active
August 29, 2015 14:25
-
-
Save romanman/08ad1da6baeb5c37e631 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Factorial | |
{ | |
public static void main(String[] args) | |
{ final int NUM_FACTS = 100; | |
for(int i = 0; i < NUM_FACTS; i++) | |
System.out.println( i + "! is " + factorial(i)); | |
} | |
public static int factorial(int n) | |
{ int result = 1; | |
for(int i = 2; i <= n; i++) | |
result *= i; | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment