Author | Message |
---|---|
jpascua
Posts: 197
|
Posted 12:59 Oct 14, 2012 |
2.5. Write a program to read the value of n and calculate the following series. 1 + 1/3 + 1/5 + 1/7 + ... + 1/(2n-1) For this question of the lab, I don't fully understand what are we supposed to do. |
rframe
Posts: 18
|
Posted 15:06 Oct 14, 2012 |
What exactly is it that you do not understand? if its the equation it is 1 / (2(1) - 1) + 1 / (2(2) - 1) + 1 / (2(3) - 1) + 1 / (2(4) - 1) + ... + 1 / (2(n) - 1) Last edited by rframe at
15:06 Oct 14, 2012.
|
jpascua
Posts: 197
|
Posted 15:08 Oct 14, 2012 |
Well, is the value of "n" supposed to be given or does the user input the value? |
rframe
Posts: 18
|
Posted 15:25 Oct 14, 2012 |
That part is probably left to your choice, what chapter of the book are you guys on? |
jpascua
Posts: 197
|
Posted 15:27 Oct 14, 2012 |
Chapter 4 (Loops). |
rframe
Posts: 18
|
Posted 15:39 Oct 14, 2012 |
1/2n-1 is going to approach 0 so what I would do if I was writing the program is use a large value for n |
jpascua
Posts: 197
|
Posted 15:41 Oct 14, 2012 |
So the user has to input a large value for "n"? |
rframe
Posts: 18
|
Posted 15:43 Oct 14, 2012 |
I would sent the n to a large value |
rframe
Posts: 18
|
Posted 15:43 Oct 14, 2012 |
But like I said that seems like your choice |
rframe
Posts: 18
|
Posted 15:44 Oct 14, 2012 |
becareful because if your output is 1 then you have an error |
hpguo
Posts: 139
|
Posted 22:42 Oct 14, 2012 |
Just make it clear that the user can type any positive integer for n. Here are some examples of n and the corresponding value of the series.: n value 1 1 2 1+1/3 3 1+1/3+1/5 4 1+1/3+1/5+1/7 100 1+1/3+1/5+1/7+...+1/199 |