473,441 Members | 2,114 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,441 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 1705
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>...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.