473,323 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Need some logic to do math with factorials

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 1699
YarrOfDoom
1,247 Expert 1GB
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
  1. function double nFacultities()
  2. Dim result as double, finalresult as double, nfacultity as integer, current as integer
  3. nfacultity = 0
  4. finalresult = 0
  5. For current = 1 to 6
  6.      nfacultity = nfacultity * current
  7.      result = current / nfacultity
  8.      finalresult = finalresult + result
  9. next current
  10. nFacultities = finalresult
  11. return nFaculties
  12. end function
  13.  
Yarr Of Doom
Sep 22 '07 #2
Killer42
8,435 Expert 8TB
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
YarrOfDoom
1,247 Expert 1GB
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
Killer42
8,435 Expert 8TB
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

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: TSK | last post by:
I cannot get my focus() fn to work in my validateInput(userInput) fn. It will not allow the user to go back and correct invalid input like it should. Instead it goes right on through with the...
5
by: Mad Scientist Jr | last post by:
Has anyone worked on code that that can parse evaluation expressions (could be numbers or strings) like ( ( "dog" = "dog" ) or "foo" = "bar" ) and ("cow" = "bat" and "bye" = "hi") or ("math" =...
16
by: didier.doussaud | last post by:
I have a stange side effect in my project : in my project I need to write "gobal" to use global symbol : .... import math .... def f() : global math # necessary ?????? else next line...
10
by: pcbutts1 | last post by:
Yes this is a homework assignment. My instructor has broken english and I just could not follow along last night. How do I do this Write the program in Java (without a graphical user interface)...
16
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
5
by: skyline789 | last post by:
Hello guys! Just started learning java and kind of struggling my way through the code of factorials. Well, basically we were asked to write a code that displays the factorials of numbers from 1 to...
4
by: Basilisk96 | last post by:
This topic is difficult to describe in one subject sentence... Has anyone come across the application of the simple statement "if (object1's attributes meet some conditions) then (set object2's...
59
by: Py-Fun | last post by:
I'm stuck trying to write a function that generates a factorial of a number using iteration and not recursion. Any simple ideas would be appreciated.
4
by: Voltem | last post by:
Hey everyone I just registered. Seems like a nice community and all the other sentimental BS :). So my problem in a nutshell is I wanna write a programme that calculates Large factorials (lets say...
5
by: catgreg | last post by:
I am currently working on a c++ program that computes factorials and I can't get it to work for some reason, i could really use a hint, this is what I have thus far for code: #include<iostream>...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.