Fast, Recursive Factorial function - C#





6
Date Submitted Thu. Jan. 4th, 2007 4:30 AM
Revision 1 of 1
Beginner jimmah
Tags C | factorial | Fast | Recursive
Comments 3 comments
Gives factorials for a given value.

public static long Factorial(long val) {
    return val == 1 ? val:val*Factorial(val - 1);
}
 

Comments

Comments C# != C
Wed. Apr. 2nd, 2008 2:58 PM    Scripter sehrgut
Comments Fast != Recursive
Sat. May. 10th, 2008 10:07 AM    Beginner Kelmi
Comments overflow
Mon. Jun. 25th, 2007 5:34 PM    Newbie bmofo

Voting