435,062 Members | 1,358 Online
Need help? Post your question and get tips & solutions from a community of 435,062 IT Pros & Developers. It's quick & easy.

# Need some logic to do math with factorials

 P: 1 this question i cant answer it maybe you will laugh but i cant the question is: 1/1!+2/2!+3/3!+4/4!+5/5!+6/6! i want the answer in visual basic language please i am waiting for reply Sep 22 '07 #1
4 Replies

 Expert 100+ P: 1,247 I don't have visual studio here, so I can't give you guaranteed bug-free code but this should do it: Expand|Select|Wrap|Line Numbers function double nFacultities() Dim result as double, finalresult as double, nfacultity as integer, current as integer nfacultity = 0 finalresult = 0 For current = 1 to 6      nfacultity = nfacultity * current      result = current / nfacultity      finalresult = finalresult + result next current nFacultities = finalresult return nFaculties end function   Yarr Of Doom Sep 22 '07 #2

 Expert 5K+ P: 8,434 Let me see if I can remember any maths... does the "!" indicate factorial? As in all the numbers up to there multipled together? Sep 22 '07 #3

 Expert 100+ P: 1,247 Let me see if I can remember any maths... does the "!" indicate factorial? As in all the numbers up to there multipled together? I suppose it is, I used some badly translated term from Dutch :P Yarr Of Doom Sep 23 '07 #4

 Expert 5K+ P: 8,434 Fair enough. At a glance, I think the code you already posted will do the trick. I should warn you, lothario, that I've written a function previously to calculate factorials, and they become unmanageably large very quickly. Sep 23 '07 #5