Click here to Skip to main content
14,936,036 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Factorials (C#) Pin
Xiangyang Liu 刘向阳18-Sep-08 5:08
MemberXiangyang Liu 刘向阳18-Sep-08 5:08 
GeneralRe: Factorials (C#) Pin
PIEBALDconsult18-Sep-08 5:27
professionalPIEBALDconsult18-Sep-08 5:27 
GeneralRe: Factorials (C#) Pin
Dan Neely18-Sep-08 5:33
MemberDan Neely18-Sep-08 5:33 
GeneralRe: Factorials (C#) Pin
PIEBALDconsult18-Sep-08 7:06
professionalPIEBALDconsult18-Sep-08 7:06 
GeneralRe: Factorials (C#) Pin
Robert.C.Cartaino18-Sep-08 7:34
MemberRobert.C.Cartaino18-Sep-08 7:34 
GeneralRe: Factorials (C#) Pin
Single Step Debugger18-Sep-08 8:18
MemberSingle Step Debugger18-Sep-08 8:18 
AnswerRe: Factorials (C#) Pin
Ri Qen-Sin18-Sep-08 9:52
MemberRi Qen-Sin18-Sep-08 9:52 
GeneralRe: Factorials (C#) Pin
Robert.C.Cartaino18-Sep-08 11:12
MemberRobert.C.Cartaino18-Sep-08 11:12 
Ri Qen-Sin wrote:
You might as well as craft a method to look up the answer in a pre-made dictionary or table of some sort.


I just posted this above:
public static ulong factorial(int factor)
{
    ulong[] factorials = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800,
                            39916800, 479001600, 6227020800, 87178291200, 1307674368000,
                            20922789888000, 355687428096000, 6402373705728000,
                            121645100408832000, 2432902008176640000, 14197454024290336768 };

    return factorials[factor];
}
An unsigned long value will overrun after 21!.
GeneralRe: Factorials (C#) Pin
Ri Qen-Sin18-Sep-08 11:39
MemberRi Qen-Sin18-Sep-08 11:39 
GeneralRe: Factorials (C#) Pin
Marc Clifton18-Sep-08 11:23
mvaMarc Clifton18-Sep-08 11:23 
GeneralRe: Factorials (C#) Pin
Ri Qen-Sin18-Sep-08 11:46
MemberRi Qen-Sin18-Sep-08 11:46 
GeneralRe: Factorials (C#) Pin
Stuart Dootson22-Sep-08 2:02
professionalStuart Dootson22-Sep-08 2:02 
QuestionGenius or barking? Pin
Nicholas Butler18-Sep-08 4:19
sitebuilderNicholas Butler18-Sep-08 4:19 
AnswerRe: Genius or barking? Pin
Marc Clifton18-Sep-08 4:29
mvaMarc Clifton18-Sep-08 4:29 
GeneralRe: Genius or barking? Pin
Nicholas Butler18-Sep-08 4:42
sitebuilderNicholas Butler18-Sep-08 4:42 
GeneralRe: Genius or barking? Pin
James R. Twine18-Sep-08 4:31
MemberJames R. Twine18-Sep-08 4:31 
GeneralRe: Genius or barking? Pin
Nicholas Butler18-Sep-08 4:44
sitebuilderNicholas Butler18-Sep-08 4:44 
GeneralRe: Genius or barking? Pin
John M. Drescher18-Sep-08 4:51
MemberJohn M. Drescher18-Sep-08 4:51 
AnswerRe: Genius or barking? Pin
Brady Kelly18-Sep-08 4:36
MemberBrady Kelly18-Sep-08 4:36 
GeneralRe: Genius or barking? Pin
Nicholas Butler18-Sep-08 4:47
sitebuilderNicholas Butler18-Sep-08 4:47 
AnswerRe: Genius or barking? Pin
Graham Bradshaw18-Sep-08 4:39
MemberGraham Bradshaw18-Sep-08 4:39 
GeneralRe: Genius or barking? Pin
Nicholas Butler18-Sep-08 4:50
sitebuilderNicholas Butler18-Sep-08 4:50 
GeneralRe: Genius or barking? Pin
Graham Bradshaw18-Sep-08 4:54
MemberGraham Bradshaw18-Sep-08 4:54 
GeneralRe: Genius or barking? Pin
Nicholas Butler18-Sep-08 5:07
sitebuilderNicholas Butler18-Sep-08 5:07 
GeneralRe: Genius or barking? Pin
Graham Bradshaw18-Sep-08 5:10
MemberGraham Bradshaw18-Sep-08 5:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.