Java Factorial factorial(int n)

Here you can find the source of factorial(int n)

Description

Standard factorial calculation.

License

Open Source License

Declaration

public static int factorial(int n) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from  w  ww.java  2  s. co  m
     * Standard factorial calculation.
     */
    public static int factorial(int n) {
        if (n == 0)
            return 1;
        int fact = 1;
        for (int i = 1; i <= n; i++)
            fact *= i;
        return fact;
    }
}

Related

  1. factorial(int c)
  2. factorial(int i)
  3. factorial(int input)
  4. factorial(int integer)
  5. factorial(int n)
  6. factorial(int n)
  7. factorial(int n)
  8. factorial(int n)
  9. factorial(int n)