Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
loop code
SUBMITTED BY:
shashi9985
DATE:
Aug. 23, 2016, 7:41 a.m.
FORMAT:
Text only
SIZE:
324 Bytes
Raw
Download
Tweet
HITS:
2986
Go to comments
Report
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;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus