In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,

The value of 0! is 1, according to the convention for an empty product.[1]

The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis.

This is a sample function is the implementation how to find the factorial of a given number.

public class Factorial { public static double Get(int n) { if (n==1) return 1; double fact=1; for(int i=n;i>=1;i--) { fact=fact*i; } return fact; } //find factorial using recursion public static double RecGet(int n) { if (n==1) return 1; return n * RecGet(n-1); } }

## No comments:

## Post a Comment