FileDocCategorySizeDatePackage
Factorial.javaAPI DocExample308Sat Feb 28 20:19:24 GMT 2004javathreads.examples.ch02.example1

Factorial

public class Factorial extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        int n = Integer.parseInt(args[0]);
        System.out.print(n + "! is ");
        int fact = 1;
        while (n > 1)
            fact *= n--;
        System.out.println(fact);