Java Factorial factorial(int c)

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

Description

factorial

License

Open Source License

Declaration

public static double factorial(int c) 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by      //

public class Main {
    public static double factorial(int c) {
        if (c < 0)
            throw new IllegalArgumentException("Can't take the factorial of a negative number: " + c);
        if (c == 0)
            return 1;
        return c * factorial(c - 1);
    }/*from   w w  w .j  a  v  a2  s  .c  o  m*/
}

Related

  1. factorial(double n)
  2. factorial(double n)
  3. factorial(final int a)
  4. factorial(final long value)
  5. factorial(int i)
  6. factorial(int input)
  7. factorial(int integer)
  8. factorial(int n)