Click here to Skip to main content
15,617,231 members
Articles / Programming Languages / C#

Tagged as


1 bookmarked

Calculate the Factorial of an Integer in C#

Rate me:
Please Sign up or sign in to vote.
5.00/5 (8 votes)
18 Oct 2011CPOL
Or you could just go the other direction and cache the known results ahead of time. You're only looking at 13 numbers in all, so it is not a big memory hog to just store those known values inside of the method and be done with it.static uint Factorial(uint x){ if (x > 12) throw...


Daily Counts


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
United States United States
Since I've begun my profession as a software developer, I've learned one important fact - change is inevitable. Requirements change, code changes, and life changes.

So..If you're not moving forward, you're moving backwards.

Comments and Discussions