Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
1)S=1*2+2*3+3*4+....+19*20

2)f=1+1/1!+1/2!+...+1/10!
Posted
Comments
Richard MacCutchan 28-Mar-12 4:51am    
They could if you asked a proper question.

Yes.
S = 2660
f = 2.7182818011463845
 
Share this answer
 
Comments
enigma10 28-Mar-12 5:18am    
yes how it is done in c++ code,so when we press debug to show this S=1*2+2*3+3*4+....+19*20
to our monitor
[no name] 28-Mar-12 5:27am    
Homework?
OriginalGriff 28-Mar-12 5:30am    
If it isn't, I want his job! I could do it standing on my head and typing with my toes...:laugh:
[no name] 28-Mar-12 5:37am    
"I want his job"
He's in management.
OriginalGriff 28-Mar-12 5:41am    
Hmm. So, easy coding and more money....
Try this: http://www.numberempire.com/seriescalculator.php[^]
Entering the limits 1 to 19 and the formula
n*(n+1)
gives you 2660
Entering the limits 1 to 10 and the formula
1/n!
gives you 6235301/3628800
(ok, you can calculate that fraction with a pocket calculator if you're more comfortable with that, or just take the value OriginalGriff already posted)

Now write a function for each formula that arrives at the same results, given the same inputs. To do that, these functions will need to implement the calculation of the individual terms (e. g. n*(n+1)), and then sum them up to a total.

Give it a try, it's not so hard.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900